From 352c9b2035e32e56f10f261d94955d97f4ab0f1c Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Tue, 9 Nov 1999 22:07:23 +0000 Subject: This patch adds the basic framework for the ITRON 3.0 API implementation for RTEMS. --- c/src/exec/Makefile.am | 6 +- c/src/exec/configure.in | 13 +- c/src/exec/itron/Makefile.am | 11 + c/src/exec/itron/configure.in | 78 ++++ c/src/exec/itron/include/Makefile.am | 27 ++ c/src/exec/itron/include/itron.h | 49 +++ c/src/exec/itron/include/itronsys/Makefile.am | 25 ++ c/src/exec/itron/include/itronsys/README | 9 + c/src/exec/itron/include/itronsys/eventflags.h | 143 +++++++ c/src/exec/itron/include/itronsys/fmempool.h | 122 ++++++ c/src/exec/itron/include/itronsys/intr.h | 103 ++++++ c/src/exec/itron/include/itronsys/mbox.h | 131 +++++++ c/src/exec/itron/include/itronsys/msgbuffer.h | 157 ++++++++ c/src/exec/itron/include/itronsys/network.h | 75 ++++ c/src/exec/itron/include/itronsys/port.h | 187 ++++++++++ c/src/exec/itron/include/itronsys/semaphore.h | 118 ++++++ c/src/exec/itron/include/itronsys/status.h | 67 ++++ c/src/exec/itron/include/itronsys/sysmgmt.h | 316 ++++++++++++++++ c/src/exec/itron/include/itronsys/task.h | 295 +++++++++++++++ c/src/exec/itron/include/itronsys/time.h | 182 +++++++++ c/src/exec/itron/include/itronsys/types.h | 114 ++++++ c/src/exec/itron/include/itronsys/vmempool.h | 129 +++++++ c/src/exec/itron/include/rtems/Makefile.am | 10 + c/src/exec/itron/include/rtems/itron/Makefile.am | 28 ++ c/src/exec/itron/include/rtems/itron/README | 10 + c/src/exec/itron/include/rtems/itron/config.h | 63 ++++ c/src/exec/itron/include/rtems/itron/eventflags.h | 58 +++ c/src/exec/itron/include/rtems/itron/fmempool.h | 59 +++ c/src/exec/itron/include/rtems/itron/intr.h | 28 ++ c/src/exec/itron/include/rtems/itron/itronapi.h | 27 ++ c/src/exec/itron/include/rtems/itron/mbox.h | 58 +++ c/src/exec/itron/include/rtems/itron/msgbuffer.h | 60 +++ c/src/exec/itron/include/rtems/itron/network.h | 28 ++ c/src/exec/itron/include/rtems/itron/object.h | 117 ++++++ c/src/exec/itron/include/rtems/itron/port.h | 58 +++ c/src/exec/itron/include/rtems/itron/semaphore.h | 56 +++ c/src/exec/itron/include/rtems/itron/sysmgmt.h | 28 ++ c/src/exec/itron/include/rtems/itron/task.h | 88 +++++ c/src/exec/itron/include/rtems/itron/time.h | 28 ++ c/src/exec/itron/include/rtems/itron/vmempool.h | 59 +++ c/src/exec/itron/inline/Makefile.am | 10 + c/src/exec/itron/inline/rtems/Makefile.am | 10 + c/src/exec/itron/inline/rtems/itron/Makefile.am | 27 ++ c/src/exec/itron/inline/rtems/itron/eventflags.inl | 148 ++++++++ c/src/exec/itron/inline/rtems/itron/fmempool.inl | 155 ++++++++ c/src/exec/itron/inline/rtems/itron/intr.inl | 27 ++ c/src/exec/itron/inline/rtems/itron/mbox.inl | 148 ++++++++ c/src/exec/itron/inline/rtems/itron/msgbuffer.inl | 153 ++++++++ c/src/exec/itron/inline/rtems/itron/network.inl | 27 ++ c/src/exec/itron/inline/rtems/itron/port.inl | 148 ++++++++ c/src/exec/itron/inline/rtems/itron/semaphore.inl | 180 +++++++++ c/src/exec/itron/inline/rtems/itron/sysmgmt.inl | 27 ++ c/src/exec/itron/inline/rtems/itron/task.inl | 160 ++++++++ c/src/exec/itron/inline/rtems/itron/time.inl | 27 ++ c/src/exec/itron/inline/rtems/itron/vmempool.inl | 158 ++++++++ c/src/exec/itron/src/Makefile.in | 83 +++++ c/src/exec/itron/src/can_wup.c | 30 ++ c/src/exec/itron/src/chg_pri.c | 30 ++ c/src/exec/itron/src/cre_tsk.c | 127 +++++++ c/src/exec/itron/src/del_tsk.c | 50 +++ c/src/exec/itron/src/dis_dsp.c | 35 ++ c/src/exec/itron/src/ena_dsp.c | 30 ++ c/src/exec/itron/src/eventflags.c | 152 ++++++++ c/src/exec/itron/src/exd_tsk.c | 40 ++ c/src/exec/itron/src/ext_tsk.c | 27 ++ c/src/exec/itron/src/fmempool.c | 135 +++++++ c/src/exec/itron/src/frsm_tsk.c | 31 ++ c/src/exec/itron/src/get_tid.c | 29 ++ c/src/exec/itron/src/itronintr.c | 104 ++++++ c/src/exec/itron/src/itronsem.c | 337 +++++++++++++++++ c/src/exec/itron/src/itrontime.c | 241 ++++++++++++ c/src/exec/itron/src/mbox.c | 133 +++++++ c/src/exec/itron/src/msgbuffer.c | 412 +++++++++++++++++++++ c/src/exec/itron/src/network.c | 65 ++++ c/src/exec/itron/src/port.c | 202 ++++++++++ c/src/exec/itron/src/ref_tsk.c | 31 ++ c/src/exec/itron/src/rel_wai.c | 30 ++ c/src/exec/itron/src/rot_rdq.c | 30 ++ c/src/exec/itron/src/rsm_tsk.c | 30 ++ c/src/exec/itron/src/slp_tsk.c | 28 ++ c/src/exec/itron/src/sta_tsk.c | 84 +++++ c/src/exec/itron/src/sus_tsk.c | 34 ++ c/src/exec/itron/src/sysmgmt.c | 69 ++++ c/src/exec/itron/src/task.c | 217 +++++++++++ c/src/exec/itron/src/ter_tsk.c | 30 ++ c/src/exec/itron/src/tslp_tsk.c | 31 ++ c/src/exec/itron/src/vmempool.c | 138 +++++++ c/src/exec/itron/src/wup_tsk.c | 30 ++ c/src/exec/posix/Makefile.am | 2 +- c/src/exec/posix/configure.in | 1 + c/src/exec/sapi/include/confdefs.h | 210 ++++++++++- c/src/exec/sapi/include/rtems/config.h | 18 +- c/src/exec/sapi/src/Makefile.in | 3 +- c/src/exec/sapi/src/exinit.c | 8 + c/src/exec/sapi/src/itronapi.c | 117 ++++++ c/src/exec/score/cpu/configure.in | 3 + c/src/exec/score/include/rtems/score/Makefile.in | 4 + c/src/exec/score/include/rtems/score/interr.h | 3 +- c/src/exec/score/include/rtems/score/object.h | 64 +++- c/src/exec/score/include/rtems/score/thread.h | 5 +- c/src/exec/score/include/rtems/system.h | 8 + c/src/exec/wrapup/Makefile.am | 6 +- c/src/exec/wrapup/itron/Makefile.in | 58 +++ c/src/exec/wrapup/posix/Makefile.in | 6 - c/src/tests/configure.in | 10 + c/src/tests/itrontests/Makefile.am | 21 ++ c/src/tests/itrontests/README | 6 + c/src/tests/itrontests/configure.in | 48 +++ c/src/tests/itrontests/itronhello/init.c | 30 ++ c/src/tests/itrontests/itronhello/system.h | 35 ++ c/src/tests/itrontests/itronmbf01/init.c | 362 ++++++++++++++++++ c/src/tests/itrontests/itronmbf01/system.h | 37 ++ c/src/tests/itrontests/itronsem01/init.c | 328 ++++++++++++++++ c/src/tests/itrontests/itronsem01/system.h | 39 ++ c/src/tests/itrontests/itrontask01/init.c | 72 ++++ c/src/tests/itrontests/itrontask01/system.h | 39 ++ c/src/tests/samples/configure.in | 1 + c/src/tests/tmitrontests/Makefile.am | 21 ++ c/src/tests/tmitrontests/README | 6 + c/src/tests/tmitrontests/configure.in | 45 +++ c/src/tests/tmitrontests/include/Makefile.am | 9 + c/src/tests/tmitrontests/include/timesys.h | 55 +++ c/src/tests/tmitrontests/tmitronsem01/Makefile.in | 73 ++++ c/src/tests/tmitrontests/tmitronsem01/init.c | 141 +++++++ c/src/tests/tmitrontests/tmitronsem01/system.h | 39 ++ .../tmitrontests/tmitronsem01/tmitronsem01.doc | 9 + cpukit/Makefile.am | 6 +- cpukit/itron/Makefile.am | 11 + cpukit/itron/include/Makefile.am | 27 ++ cpukit/itron/include/itron.h | 49 +++ cpukit/itron/include/itronsys/README | 9 + cpukit/itron/include/itronsys/eventflags.h | 143 +++++++ cpukit/itron/include/itronsys/fmempool.h | 122 ++++++ cpukit/itron/include/itronsys/intr.h | 103 ++++++ cpukit/itron/include/itronsys/mbox.h | 131 +++++++ cpukit/itron/include/itronsys/msgbuffer.h | 157 ++++++++ cpukit/itron/include/itronsys/network.h | 75 ++++ cpukit/itron/include/itronsys/port.h | 187 ++++++++++ cpukit/itron/include/itronsys/semaphore.h | 118 ++++++ cpukit/itron/include/itronsys/status.h | 67 ++++ cpukit/itron/include/itronsys/sysmgmt.h | 316 ++++++++++++++++ cpukit/itron/include/itronsys/task.h | 295 +++++++++++++++ cpukit/itron/include/itronsys/time.h | 182 +++++++++ cpukit/itron/include/itronsys/types.h | 114 ++++++ cpukit/itron/include/itronsys/vmempool.h | 129 +++++++ cpukit/itron/include/rtems/itron/README | 10 + cpukit/itron/include/rtems/itron/config.h | 63 ++++ cpukit/itron/include/rtems/itron/eventflags.h | 58 +++ cpukit/itron/include/rtems/itron/fmempool.h | 59 +++ cpukit/itron/include/rtems/itron/intr.h | 28 ++ cpukit/itron/include/rtems/itron/itronapi.h | 27 ++ cpukit/itron/include/rtems/itron/mbox.h | 58 +++ cpukit/itron/include/rtems/itron/msgbuffer.h | 60 +++ cpukit/itron/include/rtems/itron/network.h | 28 ++ cpukit/itron/include/rtems/itron/object.h | 117 ++++++ cpukit/itron/include/rtems/itron/port.h | 58 +++ cpukit/itron/include/rtems/itron/semaphore.h | 56 +++ cpukit/itron/include/rtems/itron/sysmgmt.h | 28 ++ cpukit/itron/include/rtems/itron/task.h | 88 +++++ cpukit/itron/include/rtems/itron/time.h | 28 ++ cpukit/itron/include/rtems/itron/vmempool.h | 59 +++ cpukit/itron/inline/Makefile.am | 10 + cpukit/itron/inline/rtems/itron/eventflags.inl | 148 ++++++++ cpukit/itron/inline/rtems/itron/fmempool.inl | 155 ++++++++ cpukit/itron/inline/rtems/itron/intr.inl | 27 ++ cpukit/itron/inline/rtems/itron/mbox.inl | 148 ++++++++ cpukit/itron/inline/rtems/itron/msgbuffer.inl | 153 ++++++++ cpukit/itron/inline/rtems/itron/network.inl | 27 ++ cpukit/itron/inline/rtems/itron/port.inl | 148 ++++++++ cpukit/itron/inline/rtems/itron/semaphore.inl | 180 +++++++++ cpukit/itron/inline/rtems/itron/sysmgmt.inl | 27 ++ cpukit/itron/inline/rtems/itron/task.inl | 160 ++++++++ cpukit/itron/inline/rtems/itron/time.inl | 27 ++ cpukit/itron/inline/rtems/itron/vmempool.inl | 158 ++++++++ cpukit/itron/src/can_wup.c | 30 ++ cpukit/itron/src/chg_pri.c | 30 ++ cpukit/itron/src/cre_tsk.c | 127 +++++++ cpukit/itron/src/del_tsk.c | 50 +++ cpukit/itron/src/dis_dsp.c | 35 ++ cpukit/itron/src/ena_dsp.c | 30 ++ cpukit/itron/src/eventflags.c | 152 ++++++++ cpukit/itron/src/exd_tsk.c | 40 ++ cpukit/itron/src/ext_tsk.c | 27 ++ cpukit/itron/src/fmempool.c | 135 +++++++ cpukit/itron/src/frsm_tsk.c | 31 ++ cpukit/itron/src/get_tid.c | 29 ++ cpukit/itron/src/itronintr.c | 104 ++++++ cpukit/itron/src/itronsem.c | 337 +++++++++++++++++ cpukit/itron/src/itrontime.c | 241 ++++++++++++ cpukit/itron/src/mbox.c | 133 +++++++ cpukit/itron/src/msgbuffer.c | 412 +++++++++++++++++++++ cpukit/itron/src/network.c | 65 ++++ cpukit/itron/src/port.c | 202 ++++++++++ cpukit/itron/src/ref_tsk.c | 31 ++ cpukit/itron/src/rel_wai.c | 30 ++ cpukit/itron/src/rot_rdq.c | 30 ++ cpukit/itron/src/rsm_tsk.c | 30 ++ cpukit/itron/src/slp_tsk.c | 28 ++ cpukit/itron/src/sta_tsk.c | 84 +++++ cpukit/itron/src/sus_tsk.c | 34 ++ cpukit/itron/src/sysmgmt.c | 69 ++++ cpukit/itron/src/task.c | 217 +++++++++++ cpukit/itron/src/ter_tsk.c | 30 ++ cpukit/itron/src/tslp_tsk.c | 31 ++ cpukit/itron/src/vmempool.c | 138 +++++++ cpukit/itron/src/wup_tsk.c | 30 ++ cpukit/posix/Makefile.am | 2 +- cpukit/sapi/include/confdefs.h | 210 ++++++++++- cpukit/sapi/include/rtems/config.h | 18 +- cpukit/sapi/src/exinit.c | 8 + cpukit/sapi/src/itronapi.c | 117 ++++++ cpukit/score/include/rtems/score/interr.h | 3 +- cpukit/score/include/rtems/score/object.h | 64 +++- cpukit/score/include/rtems/score/thread.h | 5 +- cpukit/score/include/rtems/system.h | 8 + cpukit/wrapup/Makefile.am | 6 +- testsuites/itrontests/Makefile.am | 21 ++ testsuites/itrontests/README | 6 + testsuites/itrontests/itronhello/init.c | 30 ++ testsuites/itrontests/itronhello/system.h | 35 ++ testsuites/itrontests/itronmbf01/init.c | 362 ++++++++++++++++++ testsuites/itrontests/itronmbf01/system.h | 37 ++ testsuites/itrontests/itronsem01/init.c | 328 ++++++++++++++++ testsuites/itrontests/itronsem01/system.h | 39 ++ testsuites/itrontests/itrontask01/init.c | 72 ++++ testsuites/itrontests/itrontask01/system.h | 39 ++ testsuites/tmitrontests/Makefile.am | 21 ++ testsuites/tmitrontests/README | 6 + testsuites/tmitrontests/include/Makefile.am | 9 + testsuites/tmitrontests/include/timesys.h | 55 +++ testsuites/tmitrontests/tmitronsem01/init.c | 141 +++++++ testsuites/tmitrontests/tmitronsem01/system.h | 39 ++ .../tmitrontests/tmitronsem01/tmitronsem01.doc | 9 + 233 files changed, 18684 insertions(+), 74 deletions(-) create mode 100644 c/src/exec/itron/Makefile.am create mode 100644 c/src/exec/itron/configure.in create mode 100644 c/src/exec/itron/include/Makefile.am create mode 100644 c/src/exec/itron/include/itron.h create mode 100644 c/src/exec/itron/include/itronsys/Makefile.am create mode 100644 c/src/exec/itron/include/itronsys/README create mode 100644 c/src/exec/itron/include/itronsys/eventflags.h create mode 100644 c/src/exec/itron/include/itronsys/fmempool.h create mode 100644 c/src/exec/itron/include/itronsys/intr.h create mode 100644 c/src/exec/itron/include/itronsys/mbox.h create mode 100644 c/src/exec/itron/include/itronsys/msgbuffer.h create mode 100644 c/src/exec/itron/include/itronsys/network.h create mode 100644 c/src/exec/itron/include/itronsys/port.h create mode 100644 c/src/exec/itron/include/itronsys/semaphore.h create mode 100644 c/src/exec/itron/include/itronsys/status.h create mode 100644 c/src/exec/itron/include/itronsys/sysmgmt.h create mode 100644 c/src/exec/itron/include/itronsys/task.h create mode 100644 c/src/exec/itron/include/itronsys/time.h create mode 100644 c/src/exec/itron/include/itronsys/types.h create mode 100644 c/src/exec/itron/include/itronsys/vmempool.h create mode 100644 c/src/exec/itron/include/rtems/Makefile.am create mode 100644 c/src/exec/itron/include/rtems/itron/Makefile.am create mode 100644 c/src/exec/itron/include/rtems/itron/README create mode 100644 c/src/exec/itron/include/rtems/itron/config.h create mode 100644 c/src/exec/itron/include/rtems/itron/eventflags.h create mode 100644 c/src/exec/itron/include/rtems/itron/fmempool.h create mode 100644 c/src/exec/itron/include/rtems/itron/intr.h create mode 100644 c/src/exec/itron/include/rtems/itron/itronapi.h create mode 100644 c/src/exec/itron/include/rtems/itron/mbox.h create mode 100644 c/src/exec/itron/include/rtems/itron/msgbuffer.h create mode 100644 c/src/exec/itron/include/rtems/itron/network.h create mode 100644 c/src/exec/itron/include/rtems/itron/object.h create mode 100644 c/src/exec/itron/include/rtems/itron/port.h create mode 100644 c/src/exec/itron/include/rtems/itron/semaphore.h create mode 100644 c/src/exec/itron/include/rtems/itron/sysmgmt.h create mode 100644 c/src/exec/itron/include/rtems/itron/task.h create mode 100644 c/src/exec/itron/include/rtems/itron/time.h create mode 100644 c/src/exec/itron/include/rtems/itron/vmempool.h create mode 100644 c/src/exec/itron/inline/Makefile.am create mode 100644 c/src/exec/itron/inline/rtems/Makefile.am create mode 100644 c/src/exec/itron/inline/rtems/itron/Makefile.am create mode 100644 c/src/exec/itron/inline/rtems/itron/eventflags.inl create mode 100644 c/src/exec/itron/inline/rtems/itron/fmempool.inl create mode 100644 c/src/exec/itron/inline/rtems/itron/intr.inl create mode 100644 c/src/exec/itron/inline/rtems/itron/mbox.inl create mode 100644 c/src/exec/itron/inline/rtems/itron/msgbuffer.inl create mode 100644 c/src/exec/itron/inline/rtems/itron/network.inl create mode 100644 c/src/exec/itron/inline/rtems/itron/port.inl create mode 100644 c/src/exec/itron/inline/rtems/itron/semaphore.inl create mode 100644 c/src/exec/itron/inline/rtems/itron/sysmgmt.inl create mode 100644 c/src/exec/itron/inline/rtems/itron/task.inl create mode 100644 c/src/exec/itron/inline/rtems/itron/time.inl create mode 100644 c/src/exec/itron/inline/rtems/itron/vmempool.inl create mode 100644 c/src/exec/itron/src/Makefile.in create mode 100644 c/src/exec/itron/src/can_wup.c create mode 100644 c/src/exec/itron/src/chg_pri.c create mode 100644 c/src/exec/itron/src/cre_tsk.c create mode 100644 c/src/exec/itron/src/del_tsk.c create mode 100644 c/src/exec/itron/src/dis_dsp.c create mode 100644 c/src/exec/itron/src/ena_dsp.c create mode 100644 c/src/exec/itron/src/eventflags.c create mode 100644 c/src/exec/itron/src/exd_tsk.c create mode 100644 c/src/exec/itron/src/ext_tsk.c create mode 100644 c/src/exec/itron/src/fmempool.c create mode 100644 c/src/exec/itron/src/frsm_tsk.c create mode 100644 c/src/exec/itron/src/get_tid.c create mode 100644 c/src/exec/itron/src/itronintr.c create mode 100644 c/src/exec/itron/src/itronsem.c create mode 100644 c/src/exec/itron/src/itrontime.c create mode 100644 c/src/exec/itron/src/mbox.c create mode 100644 c/src/exec/itron/src/msgbuffer.c create mode 100644 c/src/exec/itron/src/network.c create mode 100644 c/src/exec/itron/src/port.c create mode 100644 c/src/exec/itron/src/ref_tsk.c create mode 100644 c/src/exec/itron/src/rel_wai.c create mode 100644 c/src/exec/itron/src/rot_rdq.c create mode 100644 c/src/exec/itron/src/rsm_tsk.c create mode 100644 c/src/exec/itron/src/slp_tsk.c create mode 100644 c/src/exec/itron/src/sta_tsk.c create mode 100644 c/src/exec/itron/src/sus_tsk.c create mode 100644 c/src/exec/itron/src/sysmgmt.c create mode 100644 c/src/exec/itron/src/task.c create mode 100644 c/src/exec/itron/src/ter_tsk.c create mode 100644 c/src/exec/itron/src/tslp_tsk.c create mode 100644 c/src/exec/itron/src/vmempool.c create mode 100644 c/src/exec/itron/src/wup_tsk.c create mode 100644 c/src/exec/sapi/src/itronapi.c create mode 100644 c/src/exec/wrapup/itron/Makefile.in create mode 100644 c/src/tests/itrontests/Makefile.am create mode 100644 c/src/tests/itrontests/README create mode 100644 c/src/tests/itrontests/configure.in create mode 100644 c/src/tests/itrontests/itronhello/init.c create mode 100644 c/src/tests/itrontests/itronhello/system.h create mode 100644 c/src/tests/itrontests/itronmbf01/init.c create mode 100644 c/src/tests/itrontests/itronmbf01/system.h create mode 100644 c/src/tests/itrontests/itronsem01/init.c create mode 100644 c/src/tests/itrontests/itronsem01/system.h create mode 100644 c/src/tests/itrontests/itrontask01/init.c create mode 100644 c/src/tests/itrontests/itrontask01/system.h create mode 100644 c/src/tests/tmitrontests/Makefile.am create mode 100644 c/src/tests/tmitrontests/README create mode 100644 c/src/tests/tmitrontests/configure.in create mode 100644 c/src/tests/tmitrontests/include/Makefile.am create mode 100644 c/src/tests/tmitrontests/include/timesys.h create mode 100644 c/src/tests/tmitrontests/tmitronsem01/Makefile.in create mode 100644 c/src/tests/tmitrontests/tmitronsem01/init.c create mode 100644 c/src/tests/tmitrontests/tmitronsem01/system.h create mode 100644 c/src/tests/tmitrontests/tmitronsem01/tmitronsem01.doc create mode 100644 cpukit/itron/Makefile.am create mode 100644 cpukit/itron/include/Makefile.am create mode 100644 cpukit/itron/include/itron.h create mode 100644 cpukit/itron/include/itronsys/README create mode 100644 cpukit/itron/include/itronsys/eventflags.h create mode 100644 cpukit/itron/include/itronsys/fmempool.h create mode 100644 cpukit/itron/include/itronsys/intr.h create mode 100644 cpukit/itron/include/itronsys/mbox.h create mode 100644 cpukit/itron/include/itronsys/msgbuffer.h create mode 100644 cpukit/itron/include/itronsys/network.h create mode 100644 cpukit/itron/include/itronsys/port.h create mode 100644 cpukit/itron/include/itronsys/semaphore.h create mode 100644 cpukit/itron/include/itronsys/status.h create mode 100644 cpukit/itron/include/itronsys/sysmgmt.h create mode 100644 cpukit/itron/include/itronsys/task.h create mode 100644 cpukit/itron/include/itronsys/time.h create mode 100644 cpukit/itron/include/itronsys/types.h create mode 100644 cpukit/itron/include/itronsys/vmempool.h create mode 100644 cpukit/itron/include/rtems/itron/README create mode 100644 cpukit/itron/include/rtems/itron/config.h create mode 100644 cpukit/itron/include/rtems/itron/eventflags.h create mode 100644 cpukit/itron/include/rtems/itron/fmempool.h create mode 100644 cpukit/itron/include/rtems/itron/intr.h create mode 100644 cpukit/itron/include/rtems/itron/itronapi.h create mode 100644 cpukit/itron/include/rtems/itron/mbox.h create mode 100644 cpukit/itron/include/rtems/itron/msgbuffer.h create mode 100644 cpukit/itron/include/rtems/itron/network.h create mode 100644 cpukit/itron/include/rtems/itron/object.h create mode 100644 cpukit/itron/include/rtems/itron/port.h create mode 100644 cpukit/itron/include/rtems/itron/semaphore.h create mode 100644 cpukit/itron/include/rtems/itron/sysmgmt.h create mode 100644 cpukit/itron/include/rtems/itron/task.h create mode 100644 cpukit/itron/include/rtems/itron/time.h create mode 100644 cpukit/itron/include/rtems/itron/vmempool.h create mode 100644 cpukit/itron/inline/Makefile.am create mode 100644 cpukit/itron/inline/rtems/itron/eventflags.inl create mode 100644 cpukit/itron/inline/rtems/itron/fmempool.inl create mode 100644 cpukit/itron/inline/rtems/itron/intr.inl create mode 100644 cpukit/itron/inline/rtems/itron/mbox.inl create mode 100644 cpukit/itron/inline/rtems/itron/msgbuffer.inl create mode 100644 cpukit/itron/inline/rtems/itron/network.inl create mode 100644 cpukit/itron/inline/rtems/itron/port.inl create mode 100644 cpukit/itron/inline/rtems/itron/semaphore.inl create mode 100644 cpukit/itron/inline/rtems/itron/sysmgmt.inl create mode 100644 cpukit/itron/inline/rtems/itron/task.inl create mode 100644 cpukit/itron/inline/rtems/itron/time.inl create mode 100644 cpukit/itron/inline/rtems/itron/vmempool.inl create mode 100644 cpukit/itron/src/can_wup.c create mode 100644 cpukit/itron/src/chg_pri.c create mode 100644 cpukit/itron/src/cre_tsk.c create mode 100644 cpukit/itron/src/del_tsk.c create mode 100644 cpukit/itron/src/dis_dsp.c create mode 100644 cpukit/itron/src/ena_dsp.c create mode 100644 cpukit/itron/src/eventflags.c create mode 100644 cpukit/itron/src/exd_tsk.c create mode 100644 cpukit/itron/src/ext_tsk.c create mode 100644 cpukit/itron/src/fmempool.c create mode 100644 cpukit/itron/src/frsm_tsk.c create mode 100644 cpukit/itron/src/get_tid.c create mode 100644 cpukit/itron/src/itronintr.c create mode 100644 cpukit/itron/src/itronsem.c create mode 100644 cpukit/itron/src/itrontime.c create mode 100644 cpukit/itron/src/mbox.c create mode 100644 cpukit/itron/src/msgbuffer.c create mode 100644 cpukit/itron/src/network.c create mode 100644 cpukit/itron/src/port.c create mode 100644 cpukit/itron/src/ref_tsk.c create mode 100644 cpukit/itron/src/rel_wai.c create mode 100644 cpukit/itron/src/rot_rdq.c create mode 100644 cpukit/itron/src/rsm_tsk.c create mode 100644 cpukit/itron/src/slp_tsk.c create mode 100644 cpukit/itron/src/sta_tsk.c create mode 100644 cpukit/itron/src/sus_tsk.c create mode 100644 cpukit/itron/src/sysmgmt.c create mode 100644 cpukit/itron/src/task.c create mode 100644 cpukit/itron/src/ter_tsk.c create mode 100644 cpukit/itron/src/tslp_tsk.c create mode 100644 cpukit/itron/src/vmempool.c create mode 100644 cpukit/itron/src/wup_tsk.c create mode 100644 cpukit/sapi/src/itronapi.c create mode 100644 testsuites/itrontests/Makefile.am create mode 100644 testsuites/itrontests/README create mode 100644 testsuites/itrontests/itronhello/init.c create mode 100644 testsuites/itrontests/itronhello/system.h create mode 100644 testsuites/itrontests/itronmbf01/init.c create mode 100644 testsuites/itrontests/itronmbf01/system.h create mode 100644 testsuites/itrontests/itronsem01/init.c create mode 100644 testsuites/itrontests/itronsem01/system.h create mode 100644 testsuites/itrontests/itrontask01/init.c create mode 100644 testsuites/itrontests/itrontask01/system.h create mode 100644 testsuites/tmitrontests/Makefile.am create mode 100644 testsuites/tmitrontests/README create mode 100644 testsuites/tmitrontests/include/Makefile.am create mode 100644 testsuites/tmitrontests/include/timesys.h create mode 100644 testsuites/tmitrontests/tmitronsem01/init.c create mode 100644 testsuites/tmitrontests/tmitronsem01/system.h create mode 100644 testsuites/tmitrontests/tmitronsem01/tmitronsem01.doc diff --git a/c/src/exec/Makefile.am b/c/src/exec/Makefile.am index f4e7e0a9e9..3677d657e4 100644 --- a/c/src/exec/Makefile.am +++ b/c/src/exec/Makefile.am @@ -9,7 +9,11 @@ if HAS_POSIX POSIX_SUBDIRS = posix endif -SUBDIRS = score rtems $(POSIX_SUBDIRS) sapi wrapup +if HAS_ITRON +ITRON_SUBDIRS = itron +endif + +SUBDIRS = score rtems $(POSIX_SUBDIRS) $(ITRON_SUBDIRS) sapi wrapup include $(top_srcdir)/../../../automake/subdirs.am include $(top_srcdir)/../../../automake/local.am diff --git a/c/src/exec/configure.in b/c/src/exec/configure.in index 11d946929d..8701a1c634 100644 --- a/c/src/exec/configure.in +++ b/c/src/exec/configure.in @@ -13,6 +13,7 @@ AM_INIT_AUTOMAKE(rtems-c-src-exec,$RTEMS_VERSION,no) AM_MAINTAINER_MODE RTEMS_ENABLE_MULTIPROCESSING RTEMS_ENABLE_POSIX +RTEMS_ENABLE_ITRON RTEMS_ENABLE_INLINES RTEMS_ENABLE_GCC28 RTEMS_ENABLE_LIBCDIR @@ -34,6 +35,7 @@ RTEMS_CHECK_NEWLIB RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP) RTEMS_CHECK_MULTIPROCESSING(RTEMS_BSP) RTEMS_CHECK_POSIX_API(RTEMS_BSP) +RTEMS_CHECK_ITRON_API(RTEMS_BSP) # If RTEMS macros are enabled, then use them. Otherwise, use inlines. if test "$RTEMS_USE_MACROS" = "yes"; then @@ -42,6 +44,10 @@ if test "$RTEMS_USE_MACROS" = "yes"; then # The problem is that there is currently no code in posix/macros :) AC_MSG_ERROR(Macros are not implemented for the POSIX API) fi + if test "$HAS_ITRON_API" = "yes"; then + # The problem is that there is currently no code in itron/macros :) + AC_MSG_ERROR(Macros are not implemented for the ITRON API) + fi else INLINEdir="inline" fi @@ -51,9 +57,13 @@ AM_CONDITIONAL(MACROS,test "$INLINEdir" = "macros" ) AC_SUBST(RTEMS_VERSION) AM_CONDITIONAL(HAS_POSIX,test "$HAS_POSIX_API" = "yes") +AM_CONDITIONAL(HAS_ITRON,test "$HAS_ITRON_API" = "yes") if test "$HAS_POSIX_API" = "yes"; then -cfg_subdirs="posix" + cfg_subdirs="posix" +fi +if test "$HAS_ITRON_API" = "yes"; then + cfg_subdirs="$cfg_subdirs itron" fi AC_CONFIG_SUBDIRS($cfg_subdirs) AC_CONFIG_SUBDIRS(score/cpu) @@ -100,5 +110,6 @@ score/macros/rtems/score/Makefile score/src/Makefile wrapup/Makefile wrapup/rtems/Makefile +wrapup/itron/Makefile wrapup/posix/Makefile ) diff --git a/c/src/exec/itron/Makefile.am b/c/src/exec/itron/Makefile.am new file mode 100644 index 0000000000..294450228e --- /dev/null +++ b/c/src/exec/itron/Makefile.am @@ -0,0 +1,11 @@ +## +## $Id$ +## + +AUTOMAKE_OPTIONS = foreign 1.4 +ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal + +SUBDIRS = include inline src + +include $(top_srcdir)/../../../../automake/subdirs.am +include $(top_srcdir)/../../../../automake/local.am diff --git a/c/src/exec/itron/configure.in b/c/src/exec/itron/configure.in new file mode 100644 index 0000000000..c1bf5e6e1c --- /dev/null +++ b/c/src/exec/itron/configure.in @@ -0,0 +1,78 @@ +dnl Process this file with autoconf to produce a configure script. +dnl +dnl $Id$ + +AC_PREREQ(2.13) +AC_INIT(include/itronsys) +RTEMS_TOP(../../../..) +AC_CONFIG_AUX_DIR(../../../..) + +RTEMS_CANONICAL_TARGET_CPU + +AM_INIT_AUTOMAKE(rtems-c-src-exec-itron,$RTEMS_VERSION,no) +AM_MAINTAINER_MODE + +RTEMS_ENABLE_MULTIPROCESSING +RTEMS_ENABLE_ITRON +RTEMS_ENABLE_INLINES + +RTEMS_ENV_RTEMSBSP + +RTEMS_CHECK_CPU +RTEMS_CANONICAL_HOST + +RTEMS_PROJECT_ROOT + +## FIXME: needed for INSTALL_CHANGE in autoconf subdirectories +RTEMS_PATH_KSH + +dnl check target cc +RTEMS_PROG_CC_FOR_TARGET +RTEMS_CANONICALIZE_TOOLS + +# Check if there is custom/*.cfg for this BSP +RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP) +RTEMS_CHECK_MULTIPROCESSING(RTEMS_BSP) +RTEMS_CHECK_ITRON_API(RTEMS_BSP) + +# If RTEMS macros are enabled, then use them. Otherwise, use inlines. +if test "$RTEMS_USE_MACROS" = "yes"; then + INLINEdir="macros" + if test "$HAS_ITRON_API" = "yes"; then + # The problem is that there is currently no code in itron/macros :) + AC_MSG_ERROR(Macros are not implemented for the ITRON API) + fi +else + INLINEdir="inline" +fi +AM_CONDITIONAL(INLINE,test "$INLINEdir" = "inline" ) +AM_CONDITIONAL(MACROS,test "$INLINEdir" = "macros" ) + +## Needed when using automake for libs/rels +RTEMS_CHECK_NEWLIB + +# If RTEMS macros are enabled, then use them. Otherwise, refuse to build +if test "$RTEMS_USE_MACROS" = "yes"; then +# The problem is that there is currently no code in itron/macros :) +AC_MSG_ERROR(Macros are not implemented for the ITRON API) +fi + +PROJECT_INCLUDE="\$(PROJECT_ROOT)/$RTEMS_BSP/lib/include" +AC_SUBST(PROJECT_INCLUDE) + +## +## FIXME: We configure and build the macros subdirectory, too. +## Should probably use AM_CONDITIONALs to disable them in future +# Try to explicitly list a Makefile here +AC_OUTPUT( +Makefile +src/Makefile +include/Makefile +include/itronsys/Makefile +include/rtems/Makefile +include/rtems/itron/Makefile +inline/Makefile +inline/rtems/Makefile +inline/rtems/itron/Makefile +) + diff --git a/c/src/exec/itron/include/Makefile.am b/c/src/exec/itron/include/Makefile.am new file mode 100644 index 0000000000..f83468dd1b --- /dev/null +++ b/c/src/exec/itron/include/Makefile.am @@ -0,0 +1,27 @@ +## +## $Id$ +## + +AUTOMAKE_OPTIONS = foreign 1.4 + +H_PIECES = itron.h + +noinst_HEADERS = $(H_PIECES) + +TMPINSTALL_FILES = \ +$(PROJECT_INCLUDE) \ +$(noinst_HEADERS:%=$(PROJECT_INCLUDE)/%) + +$(PROJECT_INCLUDE): + @$(mkinstalldirs) $@ +$(PROJECT_INCLUDE)/%.h: %.h + $(INSTALL_DATA) $< $@ + +all-am: $(TMPINSTALL_FILES) +debug-am: $(TMPINSTALL_FILES) +profile-am: $(TMPINSTALL_FILES) + +SUBDIRS = rtems itronsys + +include $(top_srcdir)/../../../../automake/subdirs.am +include $(top_srcdir)/../../../../automake/local.am diff --git a/c/src/exec/itron/include/itron.h b/c/src/exec/itron/include/itron.h new file mode 100644 index 0000000000..2b6d2442f9 --- /dev/null +++ b/c/src/exec/itron/include/itron.h @@ -0,0 +1,49 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_h_ +#define __ITRON_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Include the basic requirements + */ + +#include /* basic RTEMS types defined by */ + /* each port */ +#include /* define all the TRON types */ + /* in terms of the RTEMS base types */ +#include /* define all ITRON status codes */ + +/* + * Now include the per manager include files + */ + +#include +#include +#include +#include +#include +#include /* network depends on this file */ +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/include/itronsys/Makefile.am b/c/src/exec/itron/include/itronsys/Makefile.am new file mode 100644 index 0000000000..c7a7286285 --- /dev/null +++ b/c/src/exec/itron/include/itronsys/Makefile.am @@ -0,0 +1,25 @@ +## +## $Id$ +## + +AUTOMAKE_OPTIONS = foreign 1.4 + +H_PIECES = eventflags.h fmempool.h intr.h mbox.h msgbuffer.h network.h \ + port.h semaphore.h status.h sysmgmt.h task.h time.h types.h vmempool.h + +noinst_HEADERS = $(H_PIECES) + +TMPINSTALL_FILES = \ +$(PROJECT_INCLUDE)/itronsys \ +$(noinst_HEADERS:%=$(PROJECT_INCLUDE)/itronsys/%) + +$(PROJECT_INCLUDE)/itronsys: + @$(mkinstalldirs) $@ +$(PROJECT_INCLUDE)/itronsys/%.h: %.h + $(INSTALL_DATA) $< $@ + +all-am: $(TMPINSTALL_FILES) +debug-am: $(TMPINSTALL_FILES) +profile-am: $(TMPINSTALL_FILES) + +include $(top_srcdir)/../../../../automake/local.am diff --git a/c/src/exec/itron/include/itronsys/README b/c/src/exec/itron/include/itronsys/README new file mode 100644 index 0000000000..8191ad3c5f --- /dev/null +++ b/c/src/exec/itron/include/itronsys/README @@ -0,0 +1,9 @@ +# +# $Id$ +# + +This directory contains the public interface of each manager. +Each file in this directory is included from . + +The private header file for each ITRON manager is in +../rtems/itron. \ No newline at end of file diff --git a/c/src/exec/itron/include/itronsys/eventflags.h b/c/src/exec/itron/include/itronsys/eventflags.h new file mode 100644 index 0000000000..27224404f7 --- /dev/null +++ b/c/src/exec/itron/include/itronsys/eventflags.h @@ -0,0 +1,143 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_EVENTFLAGS_h_ +#define __ITRON_EVENTFLAGS_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Create Eventflags (cre_flg) Structure + */ + +typedef struct t_cflg { + VP exinf; /* extended information */ + ATR flgatr; /* eventflag attribute */ + UINT iflgptn; /* initial eventflag */ + /* additional information may be included depending on the implementation */ +} T_CFLG; + +/* + * flgatr + */ + +#define TA_WSGL 0x00 /* multiple tasks are not allowed to wait (Wait + Single Task) */ +#define TA_WMUL 0x08 /* multiple tasks are allowed to wait (Wait + Multiple Task) */ + +/* + * wfmode + */ + +#define TWF_ANDW 0x00 /* AND wait */ +#define TWF_ORW 0x02 /* OR wait */ +#define TWF_CLR 0x01 /* clear specification */ + +/* + * Reference Eventflags (ref_flg) Structure + */ + +typedef struct t_rflg { + VP exinf; /* extended information */ + BOOL_ID wtsk; /* indicates whether or not there is a waiting task */ + UINT flgptn; /* eventflag bit pattern */ + /* additional information may be included depending on the implementation */ +} T_RFLG; + +/* + * Eventflag Functions + */ + +/* + * cre_flg - Create Eventflag + */ + +ER cre_flg( + ID flgid, + T_CFLG *pk_cflg +); + +/* + * del_flg - Delete Eventflag + */ + +ER del_flg( + ID flgid +); + +/* + * set_flg - Set Eventflag + */ + +ER set_flg( + ID flgid, + UINT setptn +); + +/* + * clr_flg - Clear Eventflag + */ + +ER clr_flg( + ID flgid, + UINT clrptn +); + +/* + * wai_flg - Wait on Eventflag + */ + +ER wai_flg( + UINT *p_flgptn, + ID flgid, + UINT waiptn, + UINT wfmode +); + +/* + * pol_flg - Wait for Eventflag(Polling) + */ + +ER pol_flg( + UINT *p_flgptn, + ID flgid, + UINT waiptn, + UINT wfmode +); + +/* + * twai_flg - Wait on Eventflag with Timeout + */ + +ER twai_flg( + UINT *p_flgptn, + ID flgid, + UINT waiptn, + UINT wfmode, + TMO tmout +); + +/* + * ref_flg - Reference Eventflag Status + */ + +ER ref_flg( + T_RFLG *pk_rflg, + ID flgid +); + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/include/itronsys/fmempool.h b/c/src/exec/itron/include/itronsys/fmempool.h new file mode 100644 index 0000000000..fa72c8eb31 --- /dev/null +++ b/c/src/exec/itron/include/itronsys/fmempool.h @@ -0,0 +1,122 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_FIXED_MEMORYPOOL_h_ +#define __ITRON_FIXED_MEMORYPOOL_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Create Fixed Memory Pool (cre_mpf) Structure + */ + + /* cre_mpf */ +typedef struct t_cmpf { + VP exinf; /* extended information */ + ATR mpfatr; /* memorypool attributes */ + INT mpfcnt; /* block count for entire memorypool */ + INT blfsz; /* fixed-size memory block size */ + /* additional information may be included depending on the implementation */ +} T_CMPF; + +/* + * mpfatr + */ + +#define TA_TFIFO 0x00 /* waiting tasks are handled by FIFO */ +#define TA_TPRI 0x01 /* waiting tasks are handled by priority */ + + +/* + * Reference Fixed Memory Pool (ref_mpf) Structure + */ + + /* ref_mpf */ +typedef struct t_rmpf { + VP exinf; /* extended information */ + BOOL_ID wtsk; /* indicates whether or not there are waiting tasks */ + INT frbcnt; /* free block count */ + /* additional information may be included depending on the implementation */ +} T_RMPF; + +/* + * Fixed Memory Pool Functions + */ + +/* + * cre_mpf - Create Fixed-Size Memorypool + */ + +ER cre_mpf( + ID mpfid, + T_CMPF *pk_cmpf +); + +/* + * del_mpf - Delete Fixed-Size Memorypool + */ + +ER del_mpf( + ID mpfid +); + +/* + * get_blf - Get Fixed-Size Memory Block + */ + +ER get_blf( + VP *p_blf, + ID mpfid +); + +/* + * pget_blf - Poll and Get Fixed-Size Memory Block + */ + +ER pget_blf( + VP *p_blf, + ID mpfid +); + +/* + * tget_blf - Get Fixed-Size Memory Block with Timeout + */ + +ER tget_blf( + VP *p_blf, + ID mpfid, + TMO tmout +); + +/* + * rel_blf - Release Fixed-Size Memory Block + */ + +ER rel_blf( + ID mpfid, + VP blf +); + +/* + * ref_mpf - Reference Fixed-Size Memorypool Status + */ + +ER ref_mpf( + T_RMPF *pk_rmpf, + ID mpfid +); + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/include/itronsys/intr.h b/c/src/exec/itron/include/itronsys/intr.h new file mode 100644 index 0000000000..07f0c038f2 --- /dev/null +++ b/c/src/exec/itron/include/itronsys/intr.h @@ -0,0 +1,103 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_INTERRUPT_h_ +#define __ITRON_INTERRUPT_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Define Interrupt (def_int) Structure + */ + +typedef struct t_dint { + ATR intatr; /* interrupt handler attributes */ + FP inthdr; /* interrupt handler address */ + /* additional information may be included depending on the implementation */ +} T_DINT; + +/* + * Interrupt Functions + */ + +/* + * def_int - Define Interrupt Handler + */ + +ER def_int( + UINT dintno, + T_DINT *pk_dint +); + +/* + * ret_int - Return from Interrupt Handler + */ + +void ret_int( void ); + +/* + * ret_wup - Return and Wakeup Task + */ + +void ret_wup( + ID tskid +); + +/* + * loc_cpu - Lock CPU + */ + +ER loc_cpu( void ); + +/* + * unl_cpu - Unlock CPU + */ + +ER unl_cpu( void ); + +/* + * dis_int - Disable Interrupt + */ + +ER dis_int( + UINT eintno +); + +/* + * ena_int - Enable Interrupt + */ + +ER ena_int( + UINT eintno +); + +/* + * chg_iXX - Change Interrupt Mask(Level or Priority) + */ + +ER chg_iXX( + UINT iXXXX +); + +/* + * ref_iXX - Reference Interrupt Mask(Level or Priority) + */ + +ER ref_iXX( + UINT *p_iXXXX +); + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/include/itronsys/mbox.h b/c/src/exec/itron/include/itronsys/mbox.h new file mode 100644 index 0000000000..ef0581d02e --- /dev/null +++ b/c/src/exec/itron/include/itronsys/mbox.h @@ -0,0 +1,131 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_MBOX_h_ +#define __ITRON_MBOX_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Create Mailbox (cre_mbx) Structure + */ + +typedef struct t_cmbx { + VP exinf; /* extended information */ + ATR mbxatr; /* mailbox attributes */ + /* Following is implementation-dependent function */ + INT bufcnt; /* ring buffer size */ + /* additional information may be included depending on the implementation */ +} T_CMBX; + +/* + * mbxatr + */ + +#define TA_TFIFO 0x00 /* waiting tasks are handled by FIFO */ +#define TA_TPRI 0x01 /* waiting tasks are handled by priority */ +#define TA_MFIFO 0x00 /* messages are handled by FIFO */ +#define TA_MPRI 0x02 /* messages are handled by priority */ + +typedef struct t_msg { + /* + * A region (header) reserved by the OS may be included first + * depending on the implementation. + */ + /* VB msgcont[]; XXX */ + unsigned8 msgcont[1]; +} T_MSG; + +/* + * Reference Mailbox (ref_mbx) Structure + */ + +typedef struct t_rmbx { + VP exinf; /* extended information */ + BOOL_ID wtsk; /* indicates whether or not there is a waiting task */ + T_MSG *pk_msg; /* message to be sent next */ + /* additional information may be included depending on the implementation */ +} T_RMBX; + +/* + * Mailbox Functions + */ + +/* + * cre_mbx - Create Mailbox + */ + +ER cre_mbx( + ID mbxid, + T_CMBX* pk_cmbx +); + +/* + * del_mbx - Delete Mailbox + */ + +ER del_mbx( + ID mbxid +); + +/* + * snd_msg - Send Message to Mailbox + */ + +ER snd_msg( + ID mbxid, + T_MSG *pk_msg +); + +/* + * rcv_msg - Receive Message from Mailbox + */ + +ER rcv_msg( + T_MSG **ppk_msg, + ID mbxid +); + +/* + * prcv_msg - Poll and Receive Message from Mailbox + */ + +ER prcv_msg( + T_MSG **ppk_msg, + ID mbxid +); + +/* + * trcv_msg - Receive Message from Mailbox with Timeout + */ + +ER trcv_msg( + T_MSG **ppk_msg, + ID mbxid, + TMO tmout +); + +/* + * ref_mbx - Reference Mailbox Status + */ + +ER ref_mbx( + T_RMBX *pk_rmbx, + ID mbxid +); + + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/include/itronsys/msgbuffer.h b/c/src/exec/itron/include/itronsys/msgbuffer.h new file mode 100644 index 0000000000..20a7563851 --- /dev/null +++ b/c/src/exec/itron/include/itronsys/msgbuffer.h @@ -0,0 +1,157 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_MESSAGEBUFFER_h_ +#define __ITRON_MESSAGEBUFFER_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Create Message Buffer (cre_mbf) Structure + */ + +typedef struct t_cmbf { + VP exinf; /* extended information */ + ATR mbfatr; /* messagebuffer attributes */ + INT bufsz; /* messagebuffer size */ + INT maxmsz; /* maximum size of messages */ + /* additional information may be included depending on the implementation */ +} T_CMBF; + +/* + * mbfatr + */ + +#define TA_TFIFO 0x00 /* tasks waiting to receive messages are handled + by FIFO */ +#define TA_TPRI 0x01 /* tasks waiting to receive messages are handled + by priority */ + +/* + * mbfid + */ + +#define TMBF_OS (-4) /* messagebuffer used for OS error log */ +#define TMBF_DB (-3) /* messagebuffer used for debugging */ + +/* + * Reference Message Buffer (ref_mbf) Structure + */ + +typedef struct t_rmbf { + VP exinf; /* extended information */ + BOOL_ID wtsk; /* indicates whether or not there is a */ + /* task waiting to receive a message */ + BOOL_ID stsk; /* indicates whether or not there is a */ + /* task waiting to send a message */ + INT msgsz; /* size of message to be sent next */ + INT frbufsz; /* size of free buffer */ + /* additional information may be included depending on the implementation */ +} T_RMBF; + +/* + * Message Buffer Functions + */ + +/* + * cre_mbf - Create MessageBuffer + */ + +ER cre_mbf( + ID mbfid, + T_CMBF *pk_cmbf +); + +/* + * del_mbf - Delete MessageBuffer + */ + +ER del_mbf( + ID mbfid +); + +/* + * snd_mbf - Send Message to MessageBuffer + */ + +ER snd_mbf( + ID mbfid, + VP msg, + INT msgsz +); + +/* + * psnd_mbf - Poll and Send Message to MessageBuffer + */ + +ER psnd_mbf( + ID mbfid, + VP msg, + INT msgsz +); + +/* + * tsnd_mbf - Send Message to MessageBuffer with Timeout + */ + +ER tsnd_mbf( + ID mbfid, + VP msg, + INT msgsz, + TMO tmout +); + +/* + * rcv_mbf - Receive Message from MessageBuffer + */ + +ER rcv_mbf( + VP msg, + INT *p_msgsz, + ID mbfid +); + +/* + * prcv_mbf - Poll and Receive Message from MessageBuffer + */ + +ER prcv_mbf( + VP msg, + INT *p_msgsz, + ID mbfid +); + +/* + * trcv_mbf - Receive Message from MessageBuffer with Timeout + */ + +ER trcv_mbf( + VP msg, + INT *p_msgsz, + ID mbfid, + TMO tmout +); + +/* + * ref_mbf - Reference MessageBuffer Status + */ + +ER ref_mbf( + T_RMBF *pk_rmbf, + ID mbfid +); + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/include/itronsys/network.h b/c/src/exec/itron/include/itronsys/network.h new file mode 100644 index 0000000000..21e3e0941c --- /dev/null +++ b/c/src/exec/itron/include/itronsys/network.h @@ -0,0 +1,75 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_NETWORK_h_ +#define __ITRON_NETWORK_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * NODE srcnode, dstnode, nod: + */ + +#define TND_SELF 0 /* specifies the local node */ +#define TND_OTHR (-1) /* specifies default remote node */ + +/* + * Network Functions + */ + +/* + * nrea_dat - Read Data from another Node + */ + +ER nrea_dat( + INT *p_reasz, + VP dstadr, + NODE srcnode, + VP srcadr, + INT datsz +); + +/* + * nwri_dat - Write Data to another Node + */ + +ER nwri_dat( + INT *p_wrisz, + NODE dstnode, + VP dstadr, + VP srcadr, + INT datsz +); + +/* + * nget_nod - Get Local Node Number + */ + +ER nget_nod( + NODE *p_node +); + +/* + * nget_ver - Get Version Information of another Node + */ + +ER nget_ver( + T_VER *pk_ver, + NODE node +); + + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/include/itronsys/port.h b/c/src/exec/itron/include/itronsys/port.h new file mode 100644 index 0000000000..a8935b403f --- /dev/null +++ b/c/src/exec/itron/include/itronsys/port.h @@ -0,0 +1,187 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_PORT_h_ +#define __ITRON_PORT_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Create Port (cre_por) Structure + */ + +typedef struct t_cpor { + VP exinf; /* extended information */ + ATR poratr; /* port attributes */ + INT maxcmsz; /* maximum call message size */ + INT maxrmsz; /* maximum reply message size */ + /* additional information may be included depending on the implementation */ +} T_CPOR; + +/* + * poratr + */ + +#define TA_NULL 0 /* specifies no particular attributes */ + +/* + * TA_NULL should be used in place of zeroes to turn off all + * attribute features. + */ + +/* + * Reference Port (ref_por) Structure + */ + +typedef struct t_rpor { + VP exinf; /* extended information */ + BOOL_ID wtsk; /* indicates whether or not there is a task */ + /* waiting to call a rendezvous */ + BOOL_ID atsk; /* indicates whether or not there is a task */ + /* waiting to accept a rendezvous */ + /* additional information may be included depending on the implementation */ +} T_RPOR; + +/* + * Port Functions + */ + +/* + * cre_por - Create Port for Rendezvous + */ + +ER cre_por( + ID porid, + T_CPOR *pk_cpor +); + +/* + * del_por - Delete Port for Rendezvous + */ + +ER del_por( + ID porid +); + +/* + * cal_por - Call Port for Rendezvous Poll + */ + +ER cal_por( + VP msg, + INT *p_rmsgsz, + ID porid, + UINT calptn, + INT cmsgsz +); + +/* + * pcal_por - Poll and Call Port for Rendezvous + */ + +ER pcal_por( + VP msg, + INT *p_rmsgsz, + ID porid, + UINT calptn, + INT cmsgsz +); + +/* + * tcal_por - Call Port for Rendezvous with Timeout + */ + +ER tcal_por( + VP msg, + INT *p_rmsgsz, + ID porid, + UINT calptn, + INT cmsgsz, + TMO tmout +); + +/* + * acp_por - Accept Port for Rendezvous Poll + */ + +ER acp_por( + RNO *p_rdvno, + VP msg, + INT *p_cmsgsz, + ID porid, + UINT acpptn +); + +/* + * pacp_por - Poll and Accept Port for Rendezvous + */ + +ER pacp_por( + RNO *p_rdvno, + VP msg, + INT *p_cmsgsz, + ID porid, + UINT acpptn +); + +/* + * tacp_por - Accept Port for Rendezvous with Timeout + */ + +ER tacp_por( + RNO *p_rdvno, + VP msg, + INT *p_cmsgsz, + ID porid, + UINT acpptn, + TMO tmout +); + +/* + * fwd_por - Forward Rendezvous to Other Port + */ + +ER fwd_por( + ID porid, + UINT calptn, + RNO rdvno, + VP msg, + INT cmsgsz +); + +/* + * rpl_rdv - Reply Rendezvous + */ + +ER rpl_rdv( + RNO rdvno, + VP msg, + INT rmsgsz +); + +/* + * ref_por - Reference Port Status + */ + +ER ref_por( + T_RPOR *pk_rpor, + ID porid +); + + + + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/include/itronsys/semaphore.h b/c/src/exec/itron/include/itronsys/semaphore.h new file mode 100644 index 0000000000..c149012dad --- /dev/null +++ b/c/src/exec/itron/include/itronsys/semaphore.h @@ -0,0 +1,118 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_SEMAPHORE_h_ +#define __ITRON_SEMAPHORE_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Create Semaphore (cre_sem) Structure + */ + +typedef struct t_csem { + VP exinf; /* extended information */ + ATR sematr; /* semaphore attributes */ + /* Following is the extended function for [level X]. */ + INT isemcnt; /* initial semaphore count */ + INT maxsem; /* maximum semaphore count */ + /* additional information may be included depending on the implementation */ +} T_CSEM; + +/* + * sematr - Semaphore Attribute Values + */ + +#define TA_TFIFO 0x00 /* waiting tasks are handled by FIFO */ +#define TA_TPRI 0x01 /* waiting tasks are handled by priority */ + +#define _ITRON_SEMAPHORE_UNUSED_ATTRIBUTES ~(TA_TPRI) + +/* + * Reference Semaphore (ref_sem) Structure + */ + +typedef struct t_rsem { + VP exinf; /* extended information */ + BOOL_ID wtsk; /* indicates whether or not there is a waiting task */ + INT semcnt; /* current semaphore count */ + /* additional information may be included depending on the implementation */ +} T_RSEM; + +/* + * Semaphore Functions + */ + +/* + * cre_sem - Create Semaphore + */ + +ER cre_sem( + ID semid, + T_CSEM *pk_csem +); + +/* + * del_sem - Delete Semaphore + */ + +ER del_sem( + ID semid +); + +/* + * sig_sem - Signal Semaphore + */ + +ER sig_sem( + ID semid +); + +/* + * wai_sem - Wait on Semaphore + */ + +ER wai_sem( + ID semid +); + +/* + * preq_sem - Poll and Request Semaphore + */ + +ER preq_sem( + ID semid +); + +/* + * twai_sem - Wait on Semaphore with Timeout + */ + +ER twai_sem( + ID semid, + TMO tmout +); + +/* + * ref_sem - Reference Semaphore Status + */ + +ER ref_sem( + ID semid, + T_RSEM *pk_rsem +); + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/include/itronsys/status.h b/c/src/exec/itron/include/itronsys/status.h new file mode 100644 index 0000000000..c2a640ba6a --- /dev/null +++ b/c/src/exec/itron/include/itronsys/status.h @@ -0,0 +1,67 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_STATUS_h_ +#define __ITRON_STATUS_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define E_OK 0 /* Normal completion */ +#define E_SYS (-5) /* System error */ +#define E_NOMEM (-10) /* Insufficient memory */ +#define E_NOSPT (-17) /* Feature not supported */ +#define E_INOSPT (-18) /* Feature not supported by ITRON/FILE */ + /* specification */ +#define E_RSFN (-20) /* Reserved function code number */ +#define E_RSATR (-24) /* Reserved attribute */ +#define E_PAR (-33) /* Parameter error */ +#define E_ID (-35) /* Invalid ID number */ +#define E_NOEXS (-52) /* Object does not exist */ +#define E_OBJ (-63) /* Invalid object state */ +#define E_MACV (-65) /* Memory access disabled or memory access */ + /* violation */ +#define E_OACV (-66) /* Object access violation */ +#define E_CTX (-69) /* Context error */ +#define E_QOVR (-73) /* Queuing or nesting overflow */ +#define E_DLT (-81) /* Object being waited for was deleted */ +#define E_TMOUT (-85) /* Polling failure or timeout exceeded */ +#define E_RLWAI (-86) /* WAIT state was forcibly released */ +#define EN_NOND (-113) /* Target node does not exist or cannot be */ + /* accessed */ +#define EN_OBJNO (-114) /* Specifies an object number which could not be */ + /* accessed on the target node */ +#define EN_PROTO (-115) /* Protocol not supported on target node */ +#define EN_RSFN (-116) /* System call or function not supported on */ + /* target node */ +#define EN_COMM (-117) /* No response from target node */ +#define EN_RLWAI (-118) /* Connection function response wait state was */ + /* forcibly released */ +#define EN_PAR (-119) /* A value outside the range supported by the */ + /* target node and/or transmission packet */ + /* format was specified as a parameter */ +#define EN_RPAR (-120) /* A value outside the range supported by the */ + /* issuing node and/or transmission packet */ + /* format was returned as a return parameter */ +#define EN_CTXID (-121) /* An object on another node was specified to */ + /* a system call issued from a task in dispatch */ + /* disabled state or from a task-independent */ + /* portion */ +#define EN_EXEC (-122) /* System call could not be executed due to */ + /* insufficient resources on the target node */ +#define EN_NOSPT (-123) /* Connection function not supported */ + + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/include/itronsys/sysmgmt.h b/c/src/exec/itron/include/itronsys/sysmgmt.h new file mode 100644 index 0000000000..21076cdca4 --- /dev/null +++ b/c/src/exec/itron/include/itronsys/sysmgmt.h @@ -0,0 +1,316 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_SYSTEM_MANAGEMENT_h_ +#define __ITRON_SYSTEM_MANAGEMENT_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Get Version (get_ver) Structure + */ + +typedef struct t_ver { + UH maker; /* vendor */ + UH id; /* format number */ + UH spver; /* specification version */ + UH prver; /* product version */ + UH prno[4]; /* product control information */ + UH cpu; /* CPU information */ + UH var; /* variation descriptor */ +} T_VER; + +/* + * Specific MAKER codes established as of March, 1993 are as follows. + * Due to restrictions on the assignment of CPU codes described below, it is + * necessary to use maker codes in the range 0x000 through 0x00ff for vendors + * developing CPUs. + */ + +/* + * CPU defines XXX need to name the constants + */ + +#if 0 +#define 0x000 /* No version (test systems, etc.) */ +#define 0x001 /* University of Tokyo */ +#define 0x009 /* FUJITSU LIMITED */ +#define 0x00a /* Hitachi, Ltd. */ +#define 0x00b /* Matsushita Electric Industrial Co., Ltd. */ +#define 0x00c /* Mitsubishi Electric Corporation */ +#define 0x00d /* NEC Corporation */ +#define 0x00e /* Oki Electric Industry Co., Ltd. */ +#define 0x00f /* TOSHIBA CORPORATION */ +#endif + +/* + * The above have been assigned in alphabetical order. + */ + +#if 0 +#define 0x010 /* ALPS ELECTRIC CO., LTD. */ +#define 0x011 /* WACOM Co., Ltd. */ +#define 0x012 /* Personal Media Corporation */ +#define 0x101 /* OMRON CORPORATION */ +#define 0x102 /* SEIKOSHA CO., LTD. */ +#define 0x103 /* SYSTEM ALGO CO., LTD. */ +#define 0x104 /* Tokyo Computer Service Co., Ltd. */ +#define 0x105 /* YAMAHA CORPORATION */ +#define 0x106 /* MORSON JAPAN */ +#define 0x107 /* TOSHIBA INFORMATION SYSTEMS (JAPAN) CORP. */ +#define 0x108 /* Miyazaki System Planning Office */ +#define 0x109 /* Three Ace Computer Corporation */ +#endif + +/* + * CPU Codes + * + * Figure 47 shows the format of cpu code. Some processors use the format + * given in Figure 47(1). The format given in Figure 47(2) is used for all + * other proprietary processors. + * + * The code assignment of the CPU1 region in the format given in Figure 47(1) + * is common to ITRON and BTRON specifications. The same number is used in + * the CPU type of the standard object format of BTRON specification + * operating systems implemented on a TRON-specification chip. + * + * When using the format given in Figure 47(2) the code used for MAKER1 is + * assigned by using the lower 8 bits of MAKER described in the previous + * subsection. The code assignment of CPU2 is left up to each maker. + * + * + * + * +---------------+---------------+---------------+---------------+ + * (1) | 0 0 0 0 0 0 0 0 | CPU1 | + * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ + * +---------------+---------------+---------------+---------------+ + * (2) | MAKER1 | CPU2 | + * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ + * + * Figure 47 Format of cpu Returned by get_ver + * + * + * Specific CPU codes established as of March, 1993 are as follows. + */ + +#if 0 +/* + * XXX CONVERT THESE to #defines + */ + + +/* + * Contents of the CPU1 field + */ + +#define (0x0) CPU unspecified, no CPU information given +#define (0x1) TRONCHIP32 shared +#define (0x2) reserved +#define (0x3) reserved +#define (0x4) reserved +#define (0x5) reserved (<> TRON-specification chip) +#define (0x6) reserved (<> TRON-specification chip) +#define (0x7) reserved (TRON-specification chip supporting the + LSID function) +/* CPU vendors are unspecified for codes B'00000000 through B'00000111. */ + +#define (0x8) reserved +#define (0x9) GMICRO/100 +#define (0xa) GMICRO/200 +#define (0xb) GMICRO/300 +#define (0xc) reserved +#define (0xd) TX1 +#define (0xe) TX2 +#define (0xf) reserved + +#define (0x10) reserved +#define (0x11) reserved +#define (0x12) reserved +#define (0x13) O32 +#define (0x14) reserved +#define (0x15) MN10400 +#define (0x16) reserved +#define (0x17) reserved + +#define (0x18) GMICRO/400 +#define (0x19) GMICRO/500 +#define (0x1a) reserved +#define (0x1b-0x3f) + reserved + * For GMICRO extended, TX series extended, and TRONCHIP64 chips. + +#define (0x40) Motorola 68000 +#define (0x41) Motorola 68010 +#define (0x42) Motorola 68020 +#define (0x43) Motorola 68030 +#define (0x44) Motorola 68040 +#define -(0x40-0x4f) +#define Motorola 68000 family +#define (0x50) National Semiconductor NS32032 +#define (0x50-0x5f) + National Semiconductor NS32000 family +#define (0x60) Intel 8086, 8088 +#define (0x61) Intel 80186 +#define (0x62) Intel 80286 +#define (0x63) Intel 80386 +#define (0x64) Intel 80486 +#define (0x60-0x6f) + Intel iAPX86 family + +#define (0x70-0x7f) + NEC V Series + +#define (0x80-0xff) + reserved +#endif + +/* + * Assigning Version Numbers + * + * The version numbers of ITRON and uITRON specifications take the following + * form. + * + * Ver X.YY.ZZ[.WW] + * + * where "X" represents major version number of the ITRON specification to + * distinguish ITRON1, ITRON2 and uITRON 3.0 specifications. Specific + * assignment is as follows. + * + * "X" = 1 ITRON1 specification + * = 2 ITRON2 or uITRON 2.0 specification + * = 3 uITRON 3.0 specification + * + * "YY" is a number used to distinguish versions according to changes and + * additions made to the specification. After the specification is published, + * this number is incremented in order "YY" = 00, 01, 02... according to + * version upgrades. The first digit of "YY" is 'A', 'B' or 'C' for draft + * standard versions and test versions within the TRON Association before the + * specification have been published. + * + * The "X.YY" part of the specification version numbers is returned by spver + * to get_ver system call. The corresponding hexadecimal value is used when + * "YY" includes 'A', 'B' or 'C'. + * + * "ZZ" represents a number used to distinguish versions related to the written + * style of a specification. This number is incremented in order + * "ZZ" = 00, 01, 02... when there have been changes in specification + * configuration, reordering of chapters or corrections of misprints. + * When a further distinction of the written style of specifications is + * desired, ".WW" may be added optionally after "ZZ". WW will be assumed + * to be zero if ".WW" is omitted. + */ + +/* + * Reference System (ref_sys) Structure + */ + +typedef struct t_rsys { + INT sysstat; /* system state */ + /* additional information may be included depending on the implementation */ +} T_RSYS; + +/* + * sysstat + */ + +#define TSS_TSK 0 /* normal state in which dispatching is enabled during + task portion execution */ +#define TSS_DDSP 1 /* state after dis_dsp has been executed during task + portion execution (dispatch disabled) */ +#define TSS_LOC 3 /* state after loc_cpu has been executed during task + portion execution (interrupt and dispatch disabled) + */ +#define TSS_INDP 4 /* state during execution of task-independent portions + (interrupt and timer handlers) */ + +/* + * Reference Configuration (ref_cfg) Structure + */ + +typedef struct t_rcfg { + /* details concerning members are implementation dependent */ +} T_RCFG; + +/* + * Define Service (def_svc) Structure + */ + +typedef struct t_dsvc { + ATR svcatr; /* extended SVC handler attributes */ + FP svchdr; /* extended SVC handler address */ + /* additional information may be included depending on the implementation */ +} T_DSVC; + +/* + * Define Exception (def_exc) Structure + */ + +typedef struct t_dexc { + ATR excatr; /* exception handler attributes */ + FP exchdr; /* exception handler address */ + /* additional information may be included depending on the implementation */ +} T_DEXC; + +/* + * System Management Functions + */ + +/* + * get_ver - Get Version Information + */ + +ER get_ver( + T_VER *pk_ver +); + +/* + * ref_sys - Reference Semaphore Status + */ + +ER ref_sys( + T_RSYS *pk_rsys +); + +/* + * ref_cfg - Reference Configuration Information + */ + +ER ref_cfg( + T_RCFG *pk_rcfg +); + +/* + * def_svc - Define Extended SVC Handler + */ + +ER def_svc( + FN s_fncd, + T_DSVC *pk_dsvc +); + +/* + * def_exc - Define Exception Handler + */ + +ER def_exc( + UINT exckind, + T_DEXC *pk_dexc +); + + + + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/include/itronsys/task.h b/c/src/exec/itron/include/itronsys/task.h new file mode 100644 index 0000000000..fca48c03b8 --- /dev/null +++ b/c/src/exec/itron/include/itronsys/task.h @@ -0,0 +1,295 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_TASK_h_ +#define __ITRON_TASK_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Create Task (cre_tsk) Structure + */ + +typedef struct t_ctsk { + VP exinf; /* extended information */ + ATR tskatr; /* task attributes */ + FP task; /* task start address */ + PRI itskpri; /* initial task priority */ + INT stksz; /* stack size */ + /* additional information may be included depending on the implementation */ +} T_CTSK; + +/* + * Values for the tskatr field + */ + +#define TA_ASM 0x00 /* program written in assembly language */ +#define TA_HLNG 0x01 /* program written in high-level language */ +#define TA_COP0 0x8000 /* uses coprocessor having ID = 0 */ +#define TA_COP1 0x4000 /* uses coprocessor having ID = 1 */ +#define TA_COP2 0x2000 /* uses coprocessor having ID = 2 */ +#define TA_COP3 0x1000 /* uses coprocessor having ID = 3 */ +#define TA_COP4 0x0800 /* uses coprocessor having ID = 4 */ +#define TA_COP5 0x0400 /* uses coprocessor having ID = 5 */ +#define TA_COP6 0x0200 /* uses coprocessor having ID = 6 */ +#define TA_COP7 0x0100 /* uses coprocessor having ID = 7 */ + +/* + * Values for the tskid field + */ + +#define TSK_SELF 0 /* task specifies itself */ + +/* XXX is this a mistake in ITRON? FALSE was here and in the types list */ +#if 0 + +#define FALSE 0 /* indicates a task-independent portion (return */ + /* parameters only) */ +#endif + +/* + * Values for the tskpri field + */ + +#define TPRI_INI 0 /* specifies the initial priority on */ + /* task startup (chg_pri) */ +#define TPRI_RUN 0 /* specifies the highest priority during */ + /* execution (rot_rdq) */ + + +/* + * Reference Task (ref_tsk) Structure + */ + +typedef struct t_rtsk { + VP exinf; /* extended information */ + PRI tskpri; /* current priority */ + UINT tskstat; /* task state */ + /* + * The following are represent extended features of support + * [level X] (implementation-dependent). + */ + UINT tskwait; /* cause of wait */ + ID wid; /* ID of object being waited for */ + INT wupcnt; /* wakeup request count */ + INT suscnt; /* SUSPEND request count */ + ATR tskatr; /* task attributes */ + FP task; /* task start address */ + PRI itskpri; /* initial task priority */ + INT stksz; /* stack size */ +} T_RTSK; + +/* + * Values for the tskstat field + */ + + +#define TTS_RUN 0x01 /* RUN */ +#define TTS_RDY 0x02 /* READY */ +#define TTS_WAI 0x04 /* WAIT */ +#define TTS_SUS 0x08 /* SUSPEND */ +#define TTS_WAS 0x0C /* WAIT-SUSPEND */ +#define TTS_DMT 0x10 /* DORMANT */ + +/* + * Values for the tskwait field + */ + +#define TTW_SLP 0x0001 /* wait due to slp_tsk or tslp_tsk */ +#define TTW_DLY 0x0002 /* wait due to dly_tsk */ +#define TTW_NOD 0x0008 /* connection function response wait */ +#define TTW_FLG 0x0010 /* wait due to wai_flg or twai_flg */ +#define TTW_SEM 0x0020 /* wait due to wai_sem or twai_sem */ +#define TTW_MBX 0x0040 /* wait due to rcv_msg or trcv_msg */ +#define TTW_SMBF 0x0080 /* wait due to snd_mbf or tsnd_mbf */ +#define TTW_MBF 0x0100 /* wait due to rcv_mbf or trcv_mbf */ +#define TTW_CAL 0x0200 /* wait for rendezvous call */ +#define TTW_ACP 0x0400 /* wait for rendezvous accept */ +#define TTW_RDV 0x0800 /* wait for rendezvous completion */ +#define TTW_MPL 0x1000 /* wait due to get_blk or tget_blk */ +#define TTW_MPF 0x2000 /* wait due to get_blf or tget_blf */ + +/* + * Since the task states given by tskstat and tskwait are expressed + * by bit correspondences, they are convenient when looking for OR + * conditions (such as whether a task is in WAIT or READY state). + */ + +/* + * Task Management Functions + */ + +/* + * cre_tsk - Create Task + */ + +ER cre_tsk( + ID tskid, + T_CTSK *pk_ctsk +); + +/* + * del_tsk - Delete Task + */ + +ER del_tsk( + ID tskid +); + +/* + * sta_tsk - Start Task + */ + +ER sta_tsk( + ID tskid, + INT stacd +); + +/* + * ext_tsk - Exit Issuing Task + */ + +void ext_tsk( void ); + +/* + * exd_tsk - Exit and Delete Task + */ + +void exd_tsk( void ); + +/* + * ter_tsk - Terminate Other Task + */ + +ER ter_tsk( + ID tskid +); + +/* + * dis_dsp - Disable Dispatch + */ + +ER dis_dsp( void ); + +/* + * ena_dsp - Enable Dispatch + */ + +ER ena_dsp( void ); + +/* + * chg_pri - Change Task Priority + */ + +ER chg_pri( + ID tskid, + PRI tskpri +); + +/* + * rot_rdq - Rotate Tasks on the Ready Queue + */ + +ER rot_rdq( + PRI tskpri +); + +/* + * rel_wai - Release Wait of Other Task + */ + +ER rel_wai( + ID tskid +); + +/* + * get_tid - Get Task Identifier + */ + +ER get_tid( + ID *p_tskid +); + +/* + * ref_tsk - Reference Task Status + */ + +ER ref_tsk( + T_RTSK *pk_rtsk, + ID tskid +); + + +/* + * Task-Dependent Synchronization Functions + */ + +/* + * sus_tsk - Suspend Other Task + */ + +ER sus_tsk( + ID tskid +); + +/* + * rsm_tsk - Resume Suspended Task + */ + +ER rsm_tsk( + ID tskid +); + +/* + * frsm_tsk - Forcibly Resume Suspended Task + */ + +ER frsm_tsk( + ID tskid +); + +/* + * slp_tsk - Sleep Task Sleep Task with Timeout + */ + +ER slp_tsk( void ); + +/* + * tslp_tsk - Sleep Task with Timeout + */ + +ER tslp_tsk( + TMO tmout +); + +/* + * wup_tsk - Wakeup Other Task + */ + +ER wup_tsk( + ID tskid +); + +/* + * can_wup - Cancel Wakeup Request + */ + +ER can_wup( + INT *p_wupcnt, + ID tskid +); + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/include/itronsys/time.h b/c/src/exec/itron/include/itronsys/time.h new file mode 100644 index 0000000000..780c73b842 --- /dev/null +++ b/c/src/exec/itron/include/itronsys/time.h @@ -0,0 +1,182 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_TIME_h_ +#define __ITRON_TIME_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * System Time Data Type + * + * Member configuration depends on the bit width of the processor and + * on the implementation. A total of 48 bits is recommended. + * + */ + +typedef struct t_systime { + H utime; /* upper 16 bits */ + UW ltime; /* lower 32 bits */ +} SYSTIME, CYCTIME, ALMTIME; + +/* + * XXX Look this up in the spec and figure out where it comes + * XXX from. dly_tim() references it but it was left out + * XXX of the initial cut at the header files. + */ + +typedef int DLYTIME; + +/* + * XXX (def_cyc) Structure + */ + +typedef struct t_dcyc { + VP exinf; /* extended information */ + ATR cycatr; /* cyclic handler attributes */ + FP cychdr; /* cyclic handler address */ + UINT cycact; /* cyclic handler activation */ + CYCTIME cyctim; /* cyclic startup period */ +} T_DCYC; + +/* + * cycact + */ + +#define TCY_OFF 0x00 /* do not invoke cyclic handler */ +#define TCY_ON 0x01 /* invoke cyclic handler */ +#define TCY_INT 0x02 /* initialize cycle count */ + +/* + * Reference Cyclic Handler (ref_cyc) Structure + */ + +typedef struct t_rcyc { + VP exinf; /* extended information */ + CYCTIME lfttim; /* time left before next handler startup */ + UINT cycact; /* cyclic handler activation */ + /* additional information may be included depending on the implementation */ +} T_RCYC; + +/* + * Define Alarm (def_alm) Structure + */ + +typedef struct t_dalm { + VP exinf; /* extended information */ + ATR almatr; /* alarm handler attributes */ + FP almhdr; /* alarm handler address */ + UINT tmmode; /* start time specification mode */ + ALMTIME almtim; /* handler startup time */ +} T_DALM; + +/* + * tmmode + */ + +#define TTM_ABS 0x00 /* specified as an absolute time */ +#define TTM_REL 0x01 /* specified as a relative time */ + +/* + * Reference Alarm (ref_alm) Structure + */ + +typedef struct t_ralm { + VP exinf; /* extended information */ + ALMTIME lfttim; /* time left before next handler startup */ + /* additional information may be included depending on the implementation */ +} T_RALM; + +/* + * Time Management Functions + */ + +/* + * set_tim - Set System Clock + */ + +ER set_tim( + SYSTIME *pk_tim +); + +/* + * get_tim - Get System Clock + */ + +ER get_tim( + SYSTIME *pk_tim +); + +/* + * dly_tsk - Delay Task + */ + +ER dly_tsk( + DLYTIME dlytim +); + +/* + * def_cyc - Define Cyclic Handler + */ + +ER def_cyc( + HNO cycno, + T_DCYC *pk_dcyc +); + +/* + * act_cyc - Activate Cyclic Handler + */ + +ER act_cyc( + HNO cycno, + UINT cycact +); + +/* + * ref_cyc - Reference Cyclic Handler Status + */ + +ER ref_cyc( + T_RCYC *pk_rcyc, + HNO cycno +); + +/* + * def_alm - Define Alarm Handler + */ + +ER def_alm( + HNO almno, + T_DALM *pk_dalm +); + +/* + * ref_alm - Reference Alarm Handler Status + */ + +ER ref_alm( + T_RALM *pk_ralm, + HNO almno +); + +/* + * ret_tmr - Return from Timer Handler + */ + +void ret_tmr( void ); + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/include/itronsys/types.h b/c/src/exec/itron/include/itronsys/types.h new file mode 100644 index 0000000000..fd045df6aa --- /dev/null +++ b/c/src/exec/itron/include/itronsys/types.h @@ -0,0 +1,114 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_TYPES_h_ +#define __ITRON_TYPES_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* XXX some of these may need to be moved */ + +typedef signed8 B; /* signed 8-bit integer */ +typedef signed16 H; /* signed 16-bit integer */ +typedef signed32 W; /* signed 32-bit integer */ +typedef unsigned8 UB; /* unsigned 8-bit integer */ +typedef unsigned16 UH; /* unsigned 16-bit integer */ +typedef unsigned32 UW; /* unsigned 32-bit integer */ + +typedef unsigned32 VW; /* unpredictable data type (32-bit size) */ +typedef unsigned16 VH; /* unpredictable data type (16-bit size) */ +typedef unsigned8 VB; /* unpredictable data type (8-bit size) */ + +typedef void *VP; /* pointer to an unpredictable data type */ + +typedef void (*FP)(); /* program start address */ + +/* + * 6.4 Data Types + * + * The difference between VB, VH and VW and B, H and W is that only the + * number of bits is known for the former, not the data type of the + * contents. The latter clearly represent integers. + */ + +/* + * Data Types Dependent on ITRON Specification + * + * In order to clarify the meanings of certain parameters, the + * following names are used for data types which appear frequently + * and/or have special meanings. + */ + +typedef signed32 INT; /* Signed integer (bit width of processor) */ +typedef unsigned32 UINT; /* Unsigned integer (bit width of processor) */ +typedef boolean BOOL; /* Boolean value. TRUE (1) or FALSE (0). */ +typedef signed16 FN; /* Function code. Signed integer. Maximum 2 bytes. */ +typedef int ID; /* Object ID number (???id) */ + /* Value range depends on the system. Usually */ + /* a signed integer. Certain ID values may */ + /* represent objects on other nodes when the */ + /* connection function is supported. */ + +typedef unsigned32 BOOL_ID;/* Boolean value or ID number */ + +typedef signed32 HNO; /* Handler number */ +typedef signed32 RNO; /* Rendezvous number */ +typedef signed32 NODE; /* Node Number. Usually a signed integer. */ +typedef signed32 ATR; /* Object or handler attribute. */ + /* An unsigned integer. */ +typedef signed32 ER; /* Error code. A signed integer. */ +typedef unsigned32 PRI; /* Task priority. A signed integer. */ +typedef signed32 TMO; /* Timeout value. A signed integer. */ + /* TMO_POL = 0 indicates polling, */ + /* while TMO_FEVR = -1 indicates wait forever. */ + +/* + * 6.6 Common Constants and Data Structure Packet Formats + */ + +#define NADR (-1) /* invalid address or pointer value */ + +#ifndef TRUE +#define TRUE 1 /* true */ +#endif + +#ifndef FALSE +#define FALSE 0 /* false */ +#endif + +/* + * ATR tskatr, intatr, cycatr, almatr, svcatr, excatr: + * + * TA_ASM indicates that the task or handler is directly started + * at the assembly language level. The TA_ASM attribute has the + * opposite meaning of TA_HLNG. + * + * NOTE: Really in + */ + +#if 0 +#define TA_ASM 0x00 /* program written in assembly language */ +#define TA_HLNG 0x01 /* program written in high-level language */ +#endif + +/* + * TMO tmout: + */ + +#define TMO_POL 0 /* polling */ +#define TMO_FEVR (-1) /* wait forever */ + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/include/itronsys/vmempool.h b/c/src/exec/itron/include/itronsys/vmempool.h new file mode 100644 index 0000000000..7ef45398d3 --- /dev/null +++ b/c/src/exec/itron/include/itronsys/vmempool.h @@ -0,0 +1,129 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_VARIABLE_MEMORYPOOL_h_ +#define __ITRON_VARIABLE_MEMORYPOOL_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Create Variable Memory Pool (cre_mpl) Structure + */ + +typedef struct t_cmpl { + VP exinf; /* extended information */ + ATR mplatr; /* memorypool attributes */ + INT mplsz; /* memorypool size */ + /* additional information may be included depending on the implementation */ +} T_CMPL; + +/* + * mplatr + */ + +#define TA_TFIFO 0x00 /* waiting tasks are handled by FIFO */ +#define TA_TPRI 0x01 /* waiting tasks are handled by priority */ + +/* + * mplid + */ + +#define TMPL_OS (-4) /* memorypool used by OS */ + +/* + * Reference Variable Memory Pool (ref_mpl) Structure + */ + +typedef struct t_rmpl { + VP exinf; /* extended information */ + BOOL_ID wtsk; /* indicates whether or not there are waiting tasks */ + INT frsz; /* total size of free memory */ + INT maxsz; /* size of largest contiguous memory */ + /* additional information may be included depending on the implementation */ +} T_RMPL; + +/* + * Variable Memory Pool Functions + */ + +/* + * cre_mpl - Create Variable-Size Memorypool + */ + +ER cre_mpl( + ID mplid, + T_CMPL *pk_cmpl +); + +/* + * del_mpl - Delete Variable-Size Memorypool + */ + +ER del_mpl( + ID mplid +); + +/* + * get_blk - Get Variable-Size Memory Block + */ + +ER get_blk( + VP *p_blk, + ID mplid, + INT blksz +); + +/* + * pget_blk - Poll and Get Variable-Size Memory Block + */ + +ER pget_blk( + VP *p_blk, + ID mplid, + INT blksz +); + +/* + * tget_blk - Get Variable-Size Memory Block with Timeout + */ + +ER tget_blk( + VP *p_blk, + ID mplid, + INT blksz, + TMO tmout +); + +/* + * rel_blk - Release Variable-Size Memory Block + */ + +ER rel_blk( + ID mplid, + VP blk +); + +/* + * ref_mpl - Reference Variable-Size Memorypool Status + */ + +ER ref_mpl( + T_RMPL *pk_rmpl, + ID mplid +); + + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/include/rtems/Makefile.am b/c/src/exec/itron/include/rtems/Makefile.am new file mode 100644 index 0000000000..d6766c8306 --- /dev/null +++ b/c/src/exec/itron/include/rtems/Makefile.am @@ -0,0 +1,10 @@ +## +## $Id$ +## + +AUTOMAKE_OPTIONS = foreign 1.4 + +SUBDIRS = itron + +include $(top_srcdir)/../../../../automake/subdirs.am +include $(top_srcdir)/../../../../automake/local.am diff --git a/c/src/exec/itron/include/rtems/itron/Makefile.am b/c/src/exec/itron/include/rtems/itron/Makefile.am new file mode 100644 index 0000000000..d295a8b02d --- /dev/null +++ b/c/src/exec/itron/include/rtems/itron/Makefile.am @@ -0,0 +1,28 @@ +## +## $Id$ +## + +AUTOMAKE_OPTIONS = foreign 1.4 + +H_PIECES = config.h eventflags.h fmempool.h intr.h itronapi.h mbox.h \ + msgbuffer.h network.h object.h port.h semaphore.h sysmgmt.h \ + task.h time.h vmempool.h + +noinst_HEADERS = $(H_PIECES) + +TMPINSTALL_FILES = \ +$(PROJECT_INCLUDE)/rtems/itron \ +$(H_PIECES:%=$(PROJECT_INCLUDE)/rtems/itron/%) + +$(PROJECT_INCLUDE)/rtems/itron: + @$(mkinstalldirs) $@ +$(PROJECT_INCLUDE)/rtems/itron/%.h: %.h + $(INSTALL_DATA) $< $@ + +all-am: $(TMPINSTALL_FILES) +debug-am: $(TMPINSTALL_FILES) +profile-am: $(TMPINSTALL_FILES) + +EXTRA_DIST = README + +include $(top_srcdir)/../../../../automake/local.am diff --git a/c/src/exec/itron/include/rtems/itron/README b/c/src/exec/itron/include/rtems/itron/README new file mode 100644 index 0000000000..9ac3bf3417 --- /dev/null +++ b/c/src/exec/itron/include/rtems/itron/README @@ -0,0 +1,10 @@ +# +# $Id$ +# + +This directory contains the private interface of each manager. +These files should only be included from the from the +implementation of each manager. + +The public header file for each ITRON manager is in +../../../tronsys. \ No newline at end of file diff --git a/c/src/exec/itron/include/rtems/itron/config.h b/c/src/exec/itron/include/rtems/itron/config.h new file mode 100644 index 0000000000..8403832025 --- /dev/null +++ b/c/src/exec/itron/include/rtems/itron/config.h @@ -0,0 +1,63 @@ +/* config.h + * + * This include file contains the table of user defined configuration + * parameters specific for the ITRON API. + * + * COPYRIGHT (c) 1989-1998. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __RTEMS_ITRON_CONFIGURATION_h +#define __RTEMS_ITRON_CONFIGURATION_h + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * XXX + * + * 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: + * + * + required number of each object type + */ + +/* + * For now, we are only allowing the user to specify the entry point + * and stack size for ITRON initialization threads. + */ + +typedef struct { + ID id; + T_CTSK attributes; +} itron_initialization_tasks_table; + +typedef struct { + int maximum_tasks; + int maximum_semaphores; + int maximum_eventflags; + int maximum_mailboxes; + int maximum_message_buffers; + int maximum_ports; + int maximum_memory_pools; + int maximum_fixed_memory_pools; + int number_of_initialization_tasks; + itron_initialization_tasks_table *User_initialization_tasks_table; +} itron_api_configuration_table; + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ diff --git a/c/src/exec/itron/include/rtems/itron/eventflags.h b/c/src/exec/itron/include/rtems/itron/eventflags.h new file mode 100644 index 0000000000..3bd2903aaa --- /dev/null +++ b/c/src/exec/itron/include/rtems/itron/eventflags.h @@ -0,0 +1,58 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __RTEMS_ITRON_EVENTFLAGS_h_ +#define __RTEMS_ITRON_EVENTFLAGS_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * The following defines the control block used to manage each event flag. + */ + +typedef struct { + ITRON_Objects_Control Object; + unsigned32 XXX_more_stuff_goes_here; +} ITRON_Eventflags_Control; + +/* + * The following defines the information control block used to manage + * this class of objects. + */ + +ITRON_EXTERN Objects_Information _ITRON_Eventflags_Information; + +/* + * _ITRON_Eventflags_Manager_initialization + * + * DESCRIPTION: + * + * This routine performs the initialization necessary for this manager. + */ + +void _ITRON_Eventflags_Manager_initialization( + unsigned32 maximum_eventflags +); + +/* + * XXX insert private stuff here + */ + +#include + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/include/rtems/itron/fmempool.h b/c/src/exec/itron/include/rtems/itron/fmempool.h new file mode 100644 index 0000000000..5ee17fd6b0 --- /dev/null +++ b/c/src/exec/itron/include/rtems/itron/fmempool.h @@ -0,0 +1,59 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __RTEMS_ITRON_FIXED_MEMORYPOOL_h_ +#define __RTEMS_ITRON_FIXED_MEMORYPOOL_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * The following defines the control block used to manage each + * fixed memory pool. + */ + +typedef struct { + ITRON_Objects_Control Object; + unsigned32 XXX_more_stuff_goes_here; +} ITRON_Fixed_memory_pool_Control; + +/* + * The following defines the information control block used to manage + * this class of objects. + */ + +ITRON_EXTERN Objects_Information _ITRON_Fixed_memory_pool_Information; + +/* + * _ITRON_Fixed_memory_pool_Manager_initialization + * + * DESCRIPTION: + * + * This routine performs the initialization necessary for this manager. + */ + +void _ITRON_Fixed_memory_pool_Manager_initialization( + unsigned32 maximum_fixed_memory_pools +); + +/* + * XXX insert private stuff here + */ + +#include + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/include/rtems/itron/intr.h b/c/src/exec/itron/include/rtems/itron/intr.h new file mode 100644 index 0000000000..d6d2703462 --- /dev/null +++ b/c/src/exec/itron/include/rtems/itron/intr.h @@ -0,0 +1,28 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __RTEMS_ITRON_INTERRUPT_h_ +#define __RTEMS_ITRON_INTERRUPT_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * XXX insert private stuff here + */ + +#include + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/include/rtems/itron/itronapi.h b/c/src/exec/itron/include/rtems/itron/itronapi.h new file mode 100644 index 0000000000..b66f5fa379 --- /dev/null +++ b/c/src/exec/itron/include/rtems/itron/itronapi.h @@ -0,0 +1,27 @@ +/* + * ITRON API Support + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_API_h +#define __ITRON_API_h + +#include + +/* + * _ITRON_API_Initialize + * + * Initialize the ITRON API. + */ + +void _ITRON_API_Initialize( + rtems_configuration_table *configuration_table +); + +#endif +/* end of include file */ diff --git a/c/src/exec/itron/include/rtems/itron/mbox.h b/c/src/exec/itron/include/rtems/itron/mbox.h new file mode 100644 index 0000000000..5ce4180643 --- /dev/null +++ b/c/src/exec/itron/include/rtems/itron/mbox.h @@ -0,0 +1,58 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __RTEMS_ITRON_MBOX_h_ +#define __RTEMS_ITRON_MBOX_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * The following defines the control block used to manage each mailbox. + */ + +typedef struct { + ITRON_Objects_Control Object; + unsigned32 XXX_more_stuff_goes_here; +} ITRON_Mailbox_Control; + +/* + * The following defines the information control block used to manage + * this class of objects. + */ + +ITRON_EXTERN Objects_Information _ITRON_Mailbox_Information; + +/* + * _ITRON_Mailbox_Manager_initialization + * + * DESCRIPTION: + * + * This routine performs the initialization necessary for this manager. + */ + +void _ITRON_Mailbox_Manager_initialization( + unsigned32 maximum_mailboxes +); + +/* + * XXX insert private stuff here + */ + +#include + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/include/rtems/itron/msgbuffer.h b/c/src/exec/itron/include/rtems/itron/msgbuffer.h new file mode 100644 index 0000000000..bc559b5a65 --- /dev/null +++ b/c/src/exec/itron/include/rtems/itron/msgbuffer.h @@ -0,0 +1,60 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __RTEMS_ITRON_MESSAGEBUFFER_h_ +#define __RTEMS_ITRON_MESSAGEBUFFER_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/* + * The following defines the control block used to manage each + * message buffer. + */ + +typedef struct { + ITRON_Objects_Control Object; + boolean is_priority_blocking; + CORE_message_queue_Control message_queue; +} ITRON_Message_buffer_Control; + +/* + * The following defines the information control block used to manage + * this class of objects. + */ + +ITRON_EXTERN Objects_Information _ITRON_Message_buffer_Information; + +/* + * _ITRON_Message_buffer_Manager_initialization + * + * DESCRIPTION: + * + * This routine performs the initialization necessary for this manager. + */ + +void _ITRON_Message_buffer_Manager_initialization( + unsigned32 maximum_message_buffers +); + +/* + * XXX insert private stuff here + */ + +#include + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ diff --git a/c/src/exec/itron/include/rtems/itron/network.h b/c/src/exec/itron/include/rtems/itron/network.h new file mode 100644 index 0000000000..23e1d2f7bf --- /dev/null +++ b/c/src/exec/itron/include/rtems/itron/network.h @@ -0,0 +1,28 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __RTEMS_ITRON_NETWORK_h_ +#define __RTEMS_ITRON_NETWORK_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * XXX insert private stuff here + */ + +#include + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/include/rtems/itron/object.h b/c/src/exec/itron/include/rtems/itron/object.h new file mode 100644 index 0000000000..71bc9ed6d1 --- /dev/null +++ b/c/src/exec/itron/include/rtems/itron/object.h @@ -0,0 +1,117 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __RTEMS_ITRON_OBJECT_h_ +#define __RTEMS_ITRON_OBJECT_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +typedef Objects_Control ITRON_Objects_Control; + +/* + * Maximum length of an ITRON object name + * + * NOTE: Since ITRON objects do not have names, then then length is 0. + */ + +#define ITRON_MAXIMUM_NAME_LENGTH 0 + +/* + * _ITRON_Objects_Open + * + * Make this ITRON object visible to the system. + * + * NOTE: This macro hides the fact that ITRON objects don't have names. + */ + +#define _ITRON_Objects_Open( _the_information, _the_object ) \ + _Objects_Open( (_the_information), (_the_object), 0 ) + +/* + * _ITRON_Objects_Close + * + * Make this ITRON object invisible from the system. Usually used as + * the first step of deleting an object. + */ + +#define _ITRON_Objects_Close( _the_information, _the_object ) \ + _Objects_Close( (_the_information), (_the_object) ) + +/* + * _ITRON_Objects_Allocate_by_index + * + * Allocate the ITRON object specified by "_id". The ITRON id is the + * index portion of the traditional RTEMS ID. The Classic and POSIX + * APIs do not require that a specific object be allocated. + */ + +#define _ITRON_Objects_Allocate_by_index( _the_information, _id, _sizeof ) \ + _Objects_Allocate_by_index( (_the_information), (_id), (_sizeof) ) + +/* + * _ITRON_Objects_Clarify_allocation_id_error + * + * This function is invoked when an object allocation ID error + * occurs to determine the specific ITRON error code to return. + */ + +#define _ITRON_Objects_Clarify_allocation_id_error( _the_information, _id ) \ + (((_id) < -4) ? E_OACV : /* attempt to access a "system object" */ \ + ((_id) <= 0) ? E_ID : /* bogus index of 0 - -3 */ \ + ((_id) <= (_the_information)->maximum) ? E_OBJ : /* object is in use */ \ + E_ID) /* simply a bad id */ + +/* + * _ITRON_Objects_Clarify_get_id_error + * + * This function is invoked when an object get ID error + * occurs to determine the specific ITRON error code to return. + */ + +#define _ITRON_Objects_Clarify_get_id_error( _the_information, _id ) \ + (((_id) < -4) ? E_OACV : /* attempt to access a "system object" */ \ + ((_id) <= 0) ? E_ID : /* bogus index of 0 - -3 */ \ + ((_id) <= (_the_information)->maximum) ? E_OBJ : /* object is in use */ \ + E_ID) /* simply a bad id */ + + +/* + * _ITRON_Objects_Free + * + * Free this ITRON object to the pool of inactive objects. This + * operation is the same as for the Classic and POSIX APIs. + */ + +#define _ITRON_Objects_Free( _the_information, _the_object ) \ + _Objects_Free( (_the_information), (_the_object) ) + + +/* + * _ITRON_Objects_Get + * + * Obtain (get) the pointer to the control block for the object + * specified by "id". The ITRON id passed in here is simply + * the "index" portion of the traditional RTEMS ID. This + * requires that this operation be slightly different + * from the object get used by the Classic and POSIX APIs. + */ + +#define _ITRON_Objects_Get( _the_information, _id, _the_object ) \ + _Objects_Get( (_the_information), (_id), (_the_object) ) + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/include/rtems/itron/port.h b/c/src/exec/itron/include/rtems/itron/port.h new file mode 100644 index 0000000000..cfa71c8651 --- /dev/null +++ b/c/src/exec/itron/include/rtems/itron/port.h @@ -0,0 +1,58 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __RTEMS_ITRON_PORT_h_ +#define __RTEMS_ITRON_PORT_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * The following defines the control block used to manage each port. + */ + +typedef struct { + ITRON_Objects_Control Object; + unsigned32 XXX_more_stuff_goes_here; +} ITRON_Port_Control; + +/* + * The following defines the information control block used to manage + * this class of objects. + */ + +ITRON_EXTERN Objects_Information _ITRON_Port_Information; + +/* + * _ITRON_Port_Manager_initialization + * + * DESCRIPTION: + * + * This routine performs the initialization necessary for this manager. + */ + +void _ITRON_Port_Manager_initialization( + unsigned32 maximum_ports +); + +/* + * XXX insert private stuff here + */ + +#include + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/include/rtems/itron/semaphore.h b/c/src/exec/itron/include/rtems/itron/semaphore.h new file mode 100644 index 0000000000..8bfd1d783a --- /dev/null +++ b/c/src/exec/itron/include/rtems/itron/semaphore.h @@ -0,0 +1,56 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __RTEMS_ITRON_SEMAPHORE_h_ +#define __RTEMS_ITRON_SEMAPHORE_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/* + * The following defines the control block used to manage each semaphore. + */ + +typedef struct { + ITRON_Objects_Control Object; + boolean is_priority_blocking; + CORE_semaphore_Control semaphore; +} ITRON_Semaphore_Control; + +/* + * The following defines the information control block used to manage + * this class of objects. + */ + +ITRON_EXTERN Objects_Information _ITRON_Semaphore_Information; + +/* + * _ITRON_Semaphore_Manager_initialization + * + * DESCRIPTION: + * + * This routine performs the initialization necessary for this manager. + */ + +void _ITRON_Semaphore_Manager_initialization( + unsigned32 maximum_semaphores +); + +#include + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/include/rtems/itron/sysmgmt.h b/c/src/exec/itron/include/rtems/itron/sysmgmt.h new file mode 100644 index 0000000000..92b6cf72db --- /dev/null +++ b/c/src/exec/itron/include/rtems/itron/sysmgmt.h @@ -0,0 +1,28 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __RTEMS_ITRON_TIME_h_ +#define __RTEMS_ITRON_TIME_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * XXX insert private stuff here + */ + +#include + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/include/rtems/itron/task.h b/c/src/exec/itron/include/rtems/itron/task.h new file mode 100644 index 0000000000..fffcc16d82 --- /dev/null +++ b/c/src/exec/itron/include/rtems/itron/task.h @@ -0,0 +1,88 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __RTEMS_ITRON_TASK_h_ +#define __RTEMS_ITRON_TASK_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +/* + * This macro evaluates to TRUE if there should be a "context error." + * This is defined as a blocking directive being issed from + * task-independent portions or a task in dispatch disabled state. + * + * NOTE: Dispatching is disabled in interrupts so this should cover + * both cases. + */ + +#define _ITRON_Is_in_non_task_state() \ + (_Thread_Dispatch_disable_level != 0) + +/* + * This is the API specific information required by each thread for + * the ITRON API to function correctly. + */ + + +typedef struct { + unsigned32 unused; /* no use for the API extension */ + /* structure for ITRON identified yet */ +} ITRON_API_Control; + +/* + * The following defines the information control block used to + * manage this class of objects. + */ + +ITRON_EXTERN Objects_Information _ITRON_Task_Information; + +/* + * These are used to manage the user initialization tasks. + */ + +ITRON_EXTERN itron_initialization_tasks_table + *_ITRON_Task_User_initialization_tasks; +ITRON_EXTERN unsigned32 _ITRON_Task_Number_of_initialization_tasks; + + +/* + * _ITRON_Task_Manager_initialization + * + * This routine initializes the ITRON Task Manager. + */ + +void _ITRON_Task_Manager_initialization( + unsigned32 maximum_tasks, + unsigned32 number_of_initialization_tasks, + itron_initialization_tasks_table *user_tasks +); + +/* + * + * _ITRON_Delete_task + */ + +ER _ITRON_Delete_task( + Thread_Control *the_thread +); + +#include + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/include/rtems/itron/time.h b/c/src/exec/itron/include/rtems/itron/time.h new file mode 100644 index 0000000000..0cc2d20101 --- /dev/null +++ b/c/src/exec/itron/include/rtems/itron/time.h @@ -0,0 +1,28 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __RTEMS_ITRON_TIME_h_ +#define __RTEMS_ITRON_TIME_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * XXX insert private stuff here + */ + +#include + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/include/rtems/itron/vmempool.h b/c/src/exec/itron/include/rtems/itron/vmempool.h new file mode 100644 index 0000000000..63bf3310f9 --- /dev/null +++ b/c/src/exec/itron/include/rtems/itron/vmempool.h @@ -0,0 +1,59 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __RTEMS_ITRON_VARIABLE_MEMORYPOOL_h_ +#define __RTEMS_ITRON_VARIABLE_MEMORYPOOL_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * The following defines the control block used to manage each variable + * memory pool. + */ + +typedef struct { + ITRON_Objects_Control Object; + unsigned32 XXX_more_stuff_goes_here; +} ITRON_Variable_memory_pool_Control; + +/* + * The following defines the information control block used to manage + * this class of objects. + */ + +ITRON_EXTERN Objects_Information _ITRON_Variable_memory_pool_Information; + +/* + * _ITRON_Variable_memory_pool_Manager_initialization + * + * DESCRIPTION: + * + * This routine performs the initialization necessary for this manager. + */ + +void _ITRON_Variable_memory_pool_Manager_initialization( + unsigned32 maximum_variable_memory_pools +); + +/* + * XXX insert private stuff here + */ + +#include + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/inline/Makefile.am b/c/src/exec/itron/inline/Makefile.am new file mode 100644 index 0000000000..32269fcdcd --- /dev/null +++ b/c/src/exec/itron/inline/Makefile.am @@ -0,0 +1,10 @@ +## +## $Id$ +## + +AUTOMAKE_OPTIONS = foreign 1.4 + +SUBDIRS = rtems + +include $(top_srcdir)/../../../../automake/subdirs.am +include $(top_srcdir)/../../../../automake/local.am diff --git a/c/src/exec/itron/inline/rtems/Makefile.am b/c/src/exec/itron/inline/rtems/Makefile.am new file mode 100644 index 0000000000..d6766c8306 --- /dev/null +++ b/c/src/exec/itron/inline/rtems/Makefile.am @@ -0,0 +1,10 @@ +## +## $Id$ +## + +AUTOMAKE_OPTIONS = foreign 1.4 + +SUBDIRS = itron + +include $(top_srcdir)/../../../../automake/subdirs.am +include $(top_srcdir)/../../../../automake/local.am diff --git a/c/src/exec/itron/inline/rtems/itron/Makefile.am b/c/src/exec/itron/inline/rtems/itron/Makefile.am new file mode 100644 index 0000000000..52a0ec2de6 --- /dev/null +++ b/c/src/exec/itron/inline/rtems/itron/Makefile.am @@ -0,0 +1,27 @@ +## +## $Id$ +## + +AUTOMAKE_OPTIONS = foreign 1.4 +if INLINE +I_PIECES = eventflags.inl fmempool.inl intr.inl mbox.inl msgbuffer.inl \ + network.inl port.inl semaphore.inl sysmgmt.inl task.inl \ + time.inl vmempool.inl + +noinst_HEADERS = $(I_PIECES) + +TMPINSTALL_FILES = \ +$(PROJECT_INCLUDE)/rtems/itron \ +$(I_PIECES:%=$(PROJECT_INCLUDE)/rtems/itron/%) + +$(PROJECT_INCLUDE)/rtems/itron: + @$(mkinstalldirs) $@ +$(PROJECT_INCLUDE)/rtems/itron/%.inl: %.inl + $(INSTALL_DATA) $< $@ +endif + +all-am: $(TMPINSTALL_FILES) +debug-am: $(TMPINSTALL_FILES) +profile-am: $(TMPINSTALL_FILES) + +include $(top_srcdir)/../../../../automake/local.am diff --git a/c/src/exec/itron/inline/rtems/itron/eventflags.inl b/c/src/exec/itron/inline/rtems/itron/eventflags.inl new file mode 100644 index 0000000000..af6665915c --- /dev/null +++ b/c/src/exec/itron/inline/rtems/itron/eventflags.inl @@ -0,0 +1,148 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_EVENTFLAGS_inl_ +#define __ITRON_EVENTFLAGS_inl_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * _ITRON_Eventflags_Allocate + * + * DESCRIPTION: + * + * This routine allocates the eventflags associated with the specified + * eventflags ID from the pool of inactive eventflagss. + * + * Input parameters: + * flgid - id of eventflags to allocate + * status - pointer to status variable + * + * Output parameters: + * returns - pointer to the eventflags control block + * *status - status + */ + +RTEMS_INLINE_ROUTINE ITRON_Eventflags_Control *_ITRON_Eventflags_Allocate( + ID flgid +) +{ + return (ITRON_Eventflags_Control *)_ITRON_Objects_Allocate_by_index( + &_ITRON_Eventflags_Information, + flgid, + sizeof(ITRON_Eventflags_Control) + ); +} + +/* + * _ITRON_Eventflags_Clarify_allocation_id_error + * + * This function is invoked when an object allocation ID error + * occurs to determine the specific ITRON error code to return. + */ + +#define _ITRON_Eventflags_Clarify_allocation_id_error( _id ) \ + _ITRON_Objects_Clarify_allocation_id_error( \ + &_ITRON_Eventflags_Information, (_id) ) + +/* + * _ITRON_Eventflags_Clarify_get_id_error + * + * This function is invoked when an object get ID error + * occurs to determine the specific ITRON error code to return. + */ + +#define _ITRON_Eventflags_Clarify_get_id_error( _id ) \ + _ITRON_Objects_Clarify_get_id_error( &_ITRON_Eventflags_Information, (_id) ) + +/* + * _ITRON_Eventflags_Free + * + * DESCRIPTION: + * + * This routine frees a eventflags control block to the + * inactive chain of free eventflags control blocks. + * + * Input parameters: + * the_eventflags - pointer to eventflags control block + * + * Output parameters: NONE + */ + +RTEMS_INLINE_ROUTINE void _ITRON_Eventflags_Free ( + ITRON_Eventflags_Control *the_eventflags +) +{ + _ITRON_Objects_Free( &_ITRON_Eventflags_Information, &the_eventflags->Object ); +} + +/*PAGE + * + * _ITRON_Eventflags_Get + * + * DESCRIPTION: + * + * This function maps eventflags IDs to eventflags control blocks. + * If ID corresponds to a local eventflags, then it returns + * the_eventflags control pointer which maps to ID and location + * is set to OBJECTS_LOCAL. if the eventflags ID is global and + * resides on a remote node, then location is set to OBJECTS_REMOTE, + * and the_eventflags is undefined. Otherwise, location is set + * to OBJECTS_ERROR and the_eventflags is undefined. + * + * Input parameters: + * id - ITRON eventflags ID. + * the_location - pointer to a location variable + * + * Output parameters: + * *the_location - location of the object + */ + +RTEMS_INLINE_ROUTINE ITRON_Eventflags_Control *_ITRON_Eventflags_Get ( + ID id, + Objects_Locations *location +) +{ + return (ITRON_Eventflags_Control *) + _ITRON_Objects_Get( &_ITRON_Eventflags_Information, id, location ); +} + +/*PAGE + * + * _ITRON_Eventflags_Is_null + * + * This function returns TRUE if the_eventflags is NULL and FALSE otherwise. + * + * Input parameters: + * the_eventflags - pointer to eventflags control block + * + * Output parameters: + * TRUE - if the_eventflags is NULL + * FALSE - otherwise + */ + +RTEMS_INLINE_ROUTINE boolean _ITRON_Eventflags_Is_null ( + ITRON_Eventflags_Control *the_eventflags +) +{ + return ( the_eventflags == NULL ); +} + +/* + * XXX insert inline routines here + */ + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/inline/rtems/itron/fmempool.inl b/c/src/exec/itron/inline/rtems/itron/fmempool.inl new file mode 100644 index 0000000000..38056b6671 --- /dev/null +++ b/c/src/exec/itron/inline/rtems/itron/fmempool.inl @@ -0,0 +1,155 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_FIXED_MEMORY_POOL_inl_ +#define __ITRON_FIXED_MEMORY_POOL_inl_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * _ITRON_Fixed_memory_pool_Allocate + * + * DESCRIPTION: + * + * This routine allocates the fixed_memory_pool associated with the specified + * fixed_memory_pool ID from the pool of inactive fixed_memory_pools. + * + * Input parameters: + * mpfid - id of fixed_memory_pool to allocate + * status - pointer to status variable + * + * Output parameters: + * returns - pointer to the fixed_memory_pool control block + * *status - status + */ + +RTEMS_INLINE_ROUTINE ITRON_Fixed_memory_pool_Control + *_ITRON_Fixed_memory_pool_Allocate( + ID mpfid +) +{ + return (ITRON_Fixed_memory_pool_Control *)_ITRON_Objects_Allocate_by_index( + &_ITRON_Fixed_memory_pool_Information, + mpfid, + sizeof(ITRON_Fixed_memory_pool_Control) + ); +} + +/* + * _ITRON_Fixed_memory_pool_Clarify_allocation_id_error + * + * This function is invoked when an object allocation ID error + * occurs to determine the specific ITRON error code to return. + */ + +#define _ITRON_Fixed_memory_pool_Clarify_allocation_id_error( _id ) \ + _ITRON_Objects_Clarify_allocation_id_error( \ + &_ITRON_Fixed_memory_pool_Information, (_id) ) + +/* + * _ITRON_Fixed_memory_pool_Clarify_get_id_error + * + * This function is invoked when an object get ID error + * occurs to determine the specific ITRON error code to return. + */ + +#define _ITRON_Fixed_memory_pool_Clarify_get_id_error( _id ) \ + _ITRON_Objects_Clarify_get_id_error( \ + &_ITRON_Fixed_memory_pool_Information, (_id) ) + +/* + * _ITRON_Fixed_memory_pool_Free + * + * DESCRIPTION: + * + * This routine frees a fixed_memory_pool control block to the + * inactive chain of free fixed_memory_pool control blocks. + * + * Input parameters: + * the_fixed_memory_pool - pointer to fixed_memory_pool control block + * + * Output parameters: NONE + */ + +RTEMS_INLINE_ROUTINE void _ITRON_Fixed_memory_pool_Free ( + ITRON_Fixed_memory_pool_Control *the_fixed_memory_pool +) +{ + _ITRON_Objects_Free( + &_ITRON_Fixed_memory_pool_Information, + &the_fixed_memory_pool->Object + ); +} + +/*PAGE + * + * _ITRON_Fixed_memory_pool_Get + * + * DESCRIPTION: + * + * This function maps fixed memory pool IDs to control blocks. + * If ID corresponds to a local fixed memory pool, then it returns + * the_fixed memory pool control pointer which maps to ID and location + * is set to OBJECTS_LOCAL. if the fixed memory pool ID is global and + * resides on a remote node, then location is set to OBJECTS_REMOTE, + * and the fixed memory pool is undefined. Otherwise, location is set + * to OBJECTS_ERROR and the fixed memory pool is undefined. + * + * Input parameters: + * id - ITRON fixed memory pool ID. + * the_location - pointer to a location variable + * + * Output parameters: + * *the_location - location of the object + */ + +RTEMS_INLINE_ROUTINE ITRON_Fixed_memory_pool_Control + *_ITRON_Fixed_memory_pool_Get ( + ID id, + Objects_Locations *location +) +{ + return (ITRON_Fixed_memory_pool_Control *) + _ITRON_Objects_Get( &_ITRON_Fixed_memory_pool_Information, id, location ); +} + +/*PAGE + * + * _ITRON_Fixed_memory_pool_Is_null + * + * This function returns TRUE if the_fixed_memory_pool is NULL + * and FALSE otherwise. + * + * Input parameters: + * the_fixed_memory_pool - pointer to fixed_memory_pool control block + * + * Output parameters: + * TRUE - if the_fixed_memory_pool is NULL + * FALSE - otherwise + */ + +RTEMS_INLINE_ROUTINE boolean _ITRON_Fixed_memory_pool_Is_null ( + ITRON_Fixed_memory_pool_Control *the_fixed_memory_pool +) +{ + return ( the_fixed_memory_pool == NULL ); +} + +/* + * XXX insert inline routines here + */ + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/inline/rtems/itron/intr.inl b/c/src/exec/itron/inline/rtems/itron/intr.inl new file mode 100644 index 0000000000..a991e03365 --- /dev/null +++ b/c/src/exec/itron/inline/rtems/itron/intr.inl @@ -0,0 +1,27 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_INTERRUPT_inl_ +#define __ITRON_INTERRUPT_inl_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * XXX insert inline routines here + */ + + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/inline/rtems/itron/mbox.inl b/c/src/exec/itron/inline/rtems/itron/mbox.inl new file mode 100644 index 0000000000..d6666d6435 --- /dev/null +++ b/c/src/exec/itron/inline/rtems/itron/mbox.inl @@ -0,0 +1,148 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_MAILBOX_inl_ +#define __ITRON_MAILBOX_inl_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * _ITRON_Mailbox_Allocate + * + * DESCRIPTION: + * + * This routine allocates the mailbox associated with the specified + * mailbox ID from the pool of inactive mailboxs. + * + * Input parameters: + * mbxid - id of mailbox to allocate + * status - pointer to status variable + * + * Output parameters: + * returns - pointer to the mailbox control block + * *status - status + */ + +RTEMS_INLINE_ROUTINE ITRON_Mailbox_Control *_ITRON_Mailbox_Allocate( + ID mbxid +) +{ + return (ITRON_Mailbox_Control *)_ITRON_Objects_Allocate_by_index( + &_ITRON_Mailbox_Information, + mbxid, + sizeof(ITRON_Mailbox_Control) + ); +} + +/* + * _ITRON_Mailbox_Clarify_allocation_id_error + * + * This function is invoked when an object allocation ID error + * occurs to determine the specific ITRON error code to return. + */ + +#define _ITRON_Mailbox_Clarify_allocation_id_error( _id ) \ + _ITRON_Objects_Clarify_allocation_id_error( \ + &_ITRON_Mailbox_Information, (_id) ) + +/* + * _ITRON_Mailbox_Clarify_get_id_error + * + * This function is invoked when an object get ID error + * occurs to determine the specific ITRON error code to return. + */ + +#define _ITRON_Mailbox_Clarify_get_id_error( _id ) \ + _ITRON_Objects_Clarify_get_id_error( &_ITRON_Mailbox_Information, (_id) ) + +/* + * _ITRON_Mailbox_Free + * + * DESCRIPTION: + * + * This routine frees a mailbox control block to the + * inactive chain of free mailbox control blocks. + * + * Input parameters: + * the_mailbox - pointer to mailbox control block + * + * Output parameters: NONE + */ + +RTEMS_INLINE_ROUTINE void _ITRON_Mailbox_Free ( + ITRON_Mailbox_Control *the_mailbox +) +{ + _ITRON_Objects_Free( &_ITRON_Mailbox_Information, &the_mailbox->Object ); +} + +/*PAGE + * + * _ITRON_Mailbox_Get + * + * DESCRIPTION: + * + * This function maps mailbox IDs to mailbox control blocks. + * If ID corresponds to a local mailbox, then it returns + * the_mailbox control pointer which maps to ID and location + * is set to OBJECTS_LOCAL. if the mailbox ID is global and + * resides on a remote node, then location is set to OBJECTS_REMOTE, + * and the_mailbox is undefined. Otherwise, location is set + * to OBJECTS_ERROR and the_mailbox is undefined. + * + * Input parameters: + * id - ITRON mailbox ID. + * the_location - pointer to a location variable + * + * Output parameters: + * *the_location - location of the object + */ + +RTEMS_INLINE_ROUTINE ITRON_Mailbox_Control *_ITRON_Mailbox_Get ( + ID id, + Objects_Locations *location +) +{ + return (ITRON_Mailbox_Control *) + _ITRON_Objects_Get( &_ITRON_Mailbox_Information, id, location ); +} + +/*PAGE + * + * _ITRON_Mailbox_Is_null + * + * This function returns TRUE if the_mailbox is NULL and FALSE otherwise. + * + * Input parameters: + * the_mailbox - pointer to mailbox control block + * + * Output parameters: + * TRUE - if the_mailbox is NULL + * FALSE - otherwise + */ + +RTEMS_INLINE_ROUTINE boolean _ITRON_Mailbox_Is_null ( + ITRON_Mailbox_Control *the_mailbox +) +{ + return ( the_mailbox == NULL ); +} + +/* + * XXX insert inline routines here + */ + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/inline/rtems/itron/msgbuffer.inl b/c/src/exec/itron/inline/rtems/itron/msgbuffer.inl new file mode 100644 index 0000000000..fcdca8edf7 --- /dev/null +++ b/c/src/exec/itron/inline/rtems/itron/msgbuffer.inl @@ -0,0 +1,153 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_MESSAGE_BUFFER_inl_ +#define __ITRON_MESSAGE_BUFFER_inl_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * _ITRON_Message_buffer_Allocate + * + * DESCRIPTION: + * + * This routine allocates the message buffer associated with the specified + * message buffer ID from the pool of inactive message buffers. + * + * Input parameters: + * mbfid - id of message buffer to allocate + * status - pointer to status variable + * + * Output parameters: + * returns - pointer to the message buffer control block + * *status - status + */ + +RTEMS_INLINE_ROUTINE ITRON_Message_buffer_Control + *_ITRON_Message_buffer_Allocate( + ID mbfid +) +{ + return (ITRON_Message_buffer_Control *)_ITRON_Objects_Allocate_by_index( + &_ITRON_Message_buffer_Information, + mbfid, + sizeof(ITRON_Message_buffer_Control) + ); +} + +/* + * _ITRON_Message_buffer_Clarify_allocation_id_error + * + * This function is invoked when an object allocation ID error + * occurs to determine the specific ITRON error code to return. + */ + +#define _ITRON_Message_buffer_Clarify_allocation_id_error( _id ) \ + _ITRON_Objects_Clarify_allocation_id_error( \ + &_ITRON_Message_buffer_Information, (_id) ) + +/* + * _ITRON_Message_buffer_Clarify_get_id_error + * + * This function is invoked when an object get ID error + * occurs to determine the specific ITRON error code to return. + */ + +#define _ITRON_Message_buffer_Clarify_get_id_error( _id ) \ + _ITRON_Objects_Clarify_get_id_error( &_ITRON_Message_buffer_Information, (_id) ) + +/* + * _ITRON_Message_buffer_Free + * + * DESCRIPTION: + * + * This routine frees a message buffer control block to the + * inactive chain of free message buffer control blocks. + * + * Input parameters: + * the_message_buffer - pointer to message_buffer control block + * + * Output parameters: NONE + */ + +RTEMS_INLINE_ROUTINE void _ITRON_Message_buffer_Free ( + ITRON_Message_buffer_Control *the_message_buffer +) +{ + _ITRON_Objects_Free( + &_ITRON_Message_buffer_Information, + &the_message_buffer->Object + ); +} + +/*PAGE + * + * _ITRON_Message_buffer_Get + * + * DESCRIPTION: + * + * This function maps message buffer IDs to message buffer control blocks. + * If ID corresponds to a local message buffer, then it returns + * the message buffer control pointer which maps to ID and location + * is set to OBJECTS_LOCAL. if the message buffer ID is global and + * resides on a remote node, then location is set to OBJECTS_REMOTE, + * and the message buffer is undefined. Otherwise, location is set + * to OBJECTS_ERROR and the message buffer is undefined. + * + * Input parameters: + * id - ITRON message_buffer ID. + * the_location - pointer to a location variable + * + * Output parameters: + * *the_location - location of the object + */ + +RTEMS_INLINE_ROUTINE ITRON_Message_buffer_Control *_ITRON_Message_buffer_Get ( + ID id, + Objects_Locations *location +) +{ + return (ITRON_Message_buffer_Control *) + _ITRON_Objects_Get( &_ITRON_Message_buffer_Information, id, location ); +} + +/*PAGE + * + * _ITRON_Message_buffer_Is_null + * + * This function returns TRUE if the_message_buffer is NULL + * and FALSE otherwise. + * + * Input parameters: + * the_message_buffer - pointer to message buffer control block + * + * Output parameters: + * TRUE - if the_message_buffer is NULL + * FALSE - otherwise + */ + +RTEMS_INLINE_ROUTINE boolean _ITRON_Message_buffer_Is_null ( + ITRON_Message_buffer_Control *the_message_buffer +) +{ + return ( the_message_buffer == NULL ); +} + +/* + * XXX insert inline routines here + */ + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/inline/rtems/itron/network.inl b/c/src/exec/itron/inline/rtems/itron/network.inl new file mode 100644 index 0000000000..d4932383fc --- /dev/null +++ b/c/src/exec/itron/inline/rtems/itron/network.inl @@ -0,0 +1,27 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_NETWORK_inl_ +#define __ITRON_NETWORK_inl_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * XXX insert inline routines here + */ + + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/inline/rtems/itron/port.inl b/c/src/exec/itron/inline/rtems/itron/port.inl new file mode 100644 index 0000000000..5004761487 --- /dev/null +++ b/c/src/exec/itron/inline/rtems/itron/port.inl @@ -0,0 +1,148 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_PORT_inl_ +#define __ITRON_PORT_inl_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * _ITRON_Port_Allocate + * + * DESCRIPTION: + * + * This routine allocates the port associated with the specified + * port ID from the pool of inactive ports. + * + * Input parameters: + * porid - id of port to allocate + * status - pointer to status variable + * + * Output parameters: + * returns - pointer to the port control block + * *status - status + */ + +RTEMS_INLINE_ROUTINE ITRON_Port_Control *_ITRON_Port_Allocate( + ID porid +) +{ + return (ITRON_Port_Control *)_ITRON_Objects_Allocate_by_index( + &_ITRON_Port_Information, + porid, + sizeof(ITRON_Port_Control) + ); +} + +/* + * _ITRON_Port_Clarify_allocation_id_error + * + * This function is invoked when an object allocation ID error + * occurs to determine the specific ITRON error code to return. + */ + +#define _ITRON_Port_Clarify_allocation_id_error( _id ) \ + _ITRON_Objects_Clarify_allocation_id_error( \ + &_ITRON_Port_Information, (_id) ) + +/* + * _ITRON_Port_Clarify_get_id_error + * + * This function is invoked when an object get ID error + * occurs to determine the specific ITRON error code to return. + */ + +#define _ITRON_Port_Clarify_get_id_error( _id ) \ + _ITRON_Objects_Clarify_get_id_error( &_ITRON_Port_Information, (_id) ) + +/* + * _ITRON_Port_Free + * + * DESCRIPTION: + * + * This routine frees a port control block to the + * inactive chain of free port control blocks. + * + * Input parameters: + * the_port - pointer to port control block + * + * Output parameters: NONE + */ + +RTEMS_INLINE_ROUTINE void _ITRON_Port_Free ( + ITRON_Port_Control *the_port +) +{ + _ITRON_Objects_Free( &_ITRON_Port_Information, &the_port->Object ); +} + +/*PAGE + * + * _ITRON_Port_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. if the port ID is global and + * resides on a remote node, then location is set to OBJECTS_REMOTE, + * and the_port is undefined. Otherwise, location is set + * to OBJECTS_ERROR and the_port is undefined. + * + * Input parameters: + * id - ITRON port ID. + * the_location - pointer to a location variable + * + * Output parameters: + * *the_location - location of the object + */ + +RTEMS_INLINE_ROUTINE ITRON_Port_Control *_ITRON_Port_Get ( + ID id, + Objects_Locations *location +) +{ + return (ITRON_Port_Control *) + _ITRON_Objects_Get( &_ITRON_Port_Information, id, location ); +} + +/*PAGE + * + * _ITRON_Port_Is_null + * + * This function returns TRUE if the_port is NULL and FALSE otherwise. + * + * Input parameters: + * the_port - pointer to port control block + * + * Output parameters: + * TRUE - if the_port is NULL + * FALSE - otherwise + */ + +RTEMS_INLINE_ROUTINE boolean _ITRON_Port_Is_null ( + ITRON_Port_Control *the_port +) +{ + return ( the_port == NULL ); +} + +/* + * XXX insert inline routines here + */ + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/inline/rtems/itron/semaphore.inl b/c/src/exec/itron/inline/rtems/itron/semaphore.inl new file mode 100644 index 0000000000..6e6595fcdc --- /dev/null +++ b/c/src/exec/itron/inline/rtems/itron/semaphore.inl @@ -0,0 +1,180 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_SEMAPHORE_inl_ +#define __ITRON_SEMAPHORE_inl_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * _ITRON_Semaphore_Allocate + * + * DESCRIPTION: + * + * This routine allocates the semaphore associated with the specified + * semaphore ID from the pool of inactive semaphores. + * + * Input parameters: + * semid - id of semaphore to allocate + * status - pointer to status variable + * + * Output parameters: + * returns - pointer to the semaphore control block + * *status - status + */ + +RTEMS_INLINE_ROUTINE ITRON_Semaphore_Control *_ITRON_Semaphore_Allocate( + ID semid +) +{ + return (ITRON_Semaphore_Control *)_ITRON_Objects_Allocate_by_index( + &_ITRON_Semaphore_Information, + semid, + sizeof(ITRON_Semaphore_Control) + ); +} + +/* + * _ITRON_Semaphore_Clarify_allocation_id_error + * + * This function is invoked when an object allocation ID error + * occurs to determine the specific ITRON error code to return. + */ + +#define _ITRON_Semaphore_Clarify_allocation_id_error( _id ) \ + _ITRON_Objects_Clarify_allocation_id_error( \ + &_ITRON_Semaphore_Information, (_id) ) + +/* + * _ITRON_Semaphore_Clarify_get_id_error + * + * This function is invoked when an object get ID error + * occurs to determine the specific ITRON error code to return. + */ + +#define _ITRON_Semaphore_Clarify_get_id_error( _id ) \ + _ITRON_Objects_Clarify_get_id_error( &_ITRON_Semaphore_Information, (_id) ) + +/* + * _ITRON_Semaphore_Free + * + * DESCRIPTION: + * + * This routine frees a semaphore control block to the + * inactive chain of free semaphore control blocks. + * + * Input parameters: + * the_semaphore - pointer to semaphore control block + * + * Output parameters: NONE + */ + +RTEMS_INLINE_ROUTINE void _ITRON_Semaphore_Free ( + ITRON_Semaphore_Control *the_semaphore +) +{ + _ITRON_Objects_Free( &_ITRON_Semaphore_Information, &the_semaphore->Object ); +} + +/*PAGE + * + * _ITRON_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. + * + * Input parameters: + * id - ITRON semaphore ID. + * the_location - pointer to a location variable + * + * Output parameters: + * *the_location - location of the object + */ + +RTEMS_INLINE_ROUTINE ITRON_Semaphore_Control *_ITRON_Semaphore_Get ( + ID id, + Objects_Locations *location +) +{ + return (ITRON_Semaphore_Control *) + _ITRON_Objects_Get( &_ITRON_Semaphore_Information, id, location ); +} + +/*PAGE + * + * _ITRON_Semaphore_Is_null + * + * This function returns TRUE if the_semaphore is NULL and FALSE otherwise. + * + * Input parameters: + * the_semaphore - pointer to semaphore control block + * + * Output parameters: + * TRUE - if the_semaphore is NULL + * FALSE - otherwise + */ + +RTEMS_INLINE_ROUTINE boolean _ITRON_Semaphore_Is_null ( + ITRON_Semaphore_Control *the_semaphore +) +{ + return ( the_semaphore == NULL ); +} + +/* + * _ITRON_Semaphore_Translate_core_semaphore_return_code + * + * This function returns a ITRON status code based on the semaphore + * status code specified. + * + * Input parameters: + * the_semaphore_status - semaphore status code to translate + * + * Output parameters: + * ITRON status code - translated ITRON status code + * + */ + +RTEMS_INLINE_ROUTINE ER _ITRON_Semaphore_Translate_core_semaphore_return_code ( + unsigned32 the_semaphore_status +) +{ +/* XXX need to be able to return "E_RLWAI" */ + switch ( the_semaphore_status ) { + case CORE_SEMAPHORE_STATUS_SUCCESSFUL: + return E_OK; + case CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT: + return E_TMOUT; + case CORE_SEMAPHORE_WAS_DELETED: + return E_DLT; + case CORE_SEMAPHORE_TIMEOUT: + return E_TMOUT; + case CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED: + return E_QOVR; + case THREAD_STATUS_PROXY_BLOCKING: + return THREAD_STATUS_PROXY_BLOCKING; + } + return E_OK; /* unreached - only to remove warnings */ +} + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/inline/rtems/itron/sysmgmt.inl b/c/src/exec/itron/inline/rtems/itron/sysmgmt.inl new file mode 100644 index 0000000000..2a2eb76c6e --- /dev/null +++ b/c/src/exec/itron/inline/rtems/itron/sysmgmt.inl @@ -0,0 +1,27 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_TIME_inl_ +#define __ITRON_TIME_inl_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * XXX insert inline routines here + */ + + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/inline/rtems/itron/task.inl b/c/src/exec/itron/inline/rtems/itron/task.inl new file mode 100644 index 0000000000..1833fee84a --- /dev/null +++ b/c/src/exec/itron/inline/rtems/itron/task.inl @@ -0,0 +1,160 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_TASK_inl_ +#define __ITRON_TASK_inl_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * _ITRON_Task_Allocate + * + * DESCRIPTION: + * + * This routine allocates the task associated with the specified + * task ID from the pool of inactive tasks. + * + * Input parameters: + * tskid - id of task to allocate + * status - pointer to status variable + * + * Output parameters: + * returns - pointer to the task control block + * *status - status + */ + +RTEMS_INLINE_ROUTINE Thread_Control *_ITRON_Task_Allocate( + ID tskid +) +{ + return (Thread_Control *)_ITRON_Objects_Allocate_by_index( + &_ITRON_Task_Information, + tskid, + sizeof(Thread_Control) + ); +} + +/* + * _ITRON_Task_Clarify_allocation_id_error + * + * This function is invoked when an object allocation ID error + * occurs to determine the specific ITRON error code to return. + */ + +#define _ITRON_Task_Clarify_allocation_id_error( _id ) \ + _ITRON_Objects_Clarify_allocation_id_error( \ + &_ITRON_Task_Information, (_id) ) + +/* + * _ITRON_Task_Clarify_get_id_error + * + * This function is invoked when an object get ID error + * occurs to determine the specific ITRON error code to return. + */ + +#define _ITRON_Task_Clarify_get_id_error( _id ) \ + _ITRON_Objects_Clarify_get_id_error( &_ITRON_Task_Information, (_id) ) + +/* + * _ITRON_Task_Free + * + * DESCRIPTION: + * + * This routine frees a task control block to the + * inactive chain of free task control blocks. + * + * Input parameters: + * the_task - pointer to task control block + * + * Output parameters: NONE + */ + +RTEMS_INLINE_ROUTINE void _ITRON_Task_Free ( + Thread_Control *the_task +) +{ + _ITRON_Objects_Free( &_ITRON_Task_Information, &the_task->Object ); +} + +/*PAGE + * + * _ITRON_Task_Get + * + * DESCRIPTION: + * + * This function maps task IDs to task control blocks. + * If ID corresponds to a local task, then it returns + * the_task control pointer which maps to ID and location + * is set to OBJECTS_LOCAL. if the task ID is global and + * resides on a remote node, then location is set to OBJECTS_REMOTE, + * and the_task is undefined. Otherwise, location is set + * to OBJECTS_ERROR and the_task is undefined. + * + * Input parameters: + * id - ITRON task ID. + * the_location - pointer to a location variable + * + * Output parameters: + * *the_location - location of the object + */ + +RTEMS_INLINE_ROUTINE Thread_Control *_ITRON_Task_Get ( + ID id, + Objects_Locations *location +) +{ + return (Thread_Control *) + _ITRON_Objects_Get( &_ITRON_Task_Information, id, location ); +} + +/*PAGE + * + * _ITRON_Task_Is_null + * + * This function returns TRUE if the_task is NULL and FALSE otherwise. + * + * Input parameters: + * the_task - pointer to task control block + * + * Output parameters: + * TRUE - if the_task is NULL + * FALSE - otherwise + */ + +RTEMS_INLINE_ROUTINE boolean _ITRON_Task_Is_null ( + Thread_Control *the_task +) +{ + return ( the_task == NULL ); +} + +/* + * XXX insert inline routines here + */ + +/*PAGE + * + * _ITRON_tasks_Priority_to_Core + */ + +RTEMS_INLINE_ROUTINE Priority_Control _ITRON_Task_Priority_to_Core( + PRI _priority +) +{ + return ((Priority_Control) (_priority)); +} + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/inline/rtems/itron/time.inl b/c/src/exec/itron/inline/rtems/itron/time.inl new file mode 100644 index 0000000000..2a2eb76c6e --- /dev/null +++ b/c/src/exec/itron/inline/rtems/itron/time.inl @@ -0,0 +1,27 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_TIME_inl_ +#define __ITRON_TIME_inl_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * XXX insert inline routines here + */ + + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/inline/rtems/itron/vmempool.inl b/c/src/exec/itron/inline/rtems/itron/vmempool.inl new file mode 100644 index 0000000000..eec2931fb2 --- /dev/null +++ b/c/src/exec/itron/inline/rtems/itron/vmempool.inl @@ -0,0 +1,158 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_VARIABLE_MEMORY_POOL_inl_ +#define __ITRON_VARIABLE_MEMORY_POOL_inl_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * _ITRON_Variable_memory_pool_Allocate + * + * DESCRIPTION: + * + * This routine allocates the variable memory pool associated with + * the specified variable memory pool ID from the pool of inactive + * variable memory pools. + * + * Input parameters: + * mplid - id of variable memory pool to allocate + * status - pointer to status variable + * + * Output parameters: + * returns - pointer to the variable memory pool control block + * *status - status + */ + +RTEMS_INLINE_ROUTINE ITRON_Variable_memory_pool_Control + *_ITRON_Variable_memory_pool_Allocate( + ID mplid +) +{ + return (ITRON_Variable_memory_pool_Control *)_ITRON_Objects_Allocate_by_index( + &_ITRON_Variable_memory_pool_Information, + mplid, + sizeof(ITRON_Variable_memory_pool_Control) + ); +} + +/* + * _ITRON_Variable_memory_pool_Clarify_allocation_id_error + * + * This function is invoked when an object allocation ID error + * occurs to determine the specific ITRON error code to return. + */ + +#define _ITRON_Variable_memory_pool_Clarify_allocation_id_error( _id ) \ + _ITRON_Objects_Clarify_allocation_id_error( \ + &_ITRON_Variable_memory_pool_Information, (_id) ) + +/* + * _ITRON_Variable_memory_pool_Clarify_get_id_error + * + * This function is invoked when an object get ID error + * occurs to determine the specific ITRON error code to return. + */ + +#define _ITRON_Variable_memory_pool_Clarify_get_id_error( _id ) \ + _ITRON_Objects_Clarify_get_id_error( &_ITRON_Variable_memory_pool_Information, (_id) ) + +/* + * _ITRON_Variable_memory_pool_Free + * + * DESCRIPTION: + * + * This routine frees a variable memory pool control block to the + * inactive chain of free variable memory pool control blocks. + * + * Input parameters: + * the_variable_memory_pool - pointer to variable memory pool control block + * + * Output parameters: NONE + */ + +RTEMS_INLINE_ROUTINE void _ITRON_Variable_memory_pool_Free ( + ITRON_Variable_memory_pool_Control *the_variable_memory_pool +) +{ + _ITRON_Objects_Free( + &_ITRON_Variable_memory_pool_Information, + &the_variable_memory_pool->Object + ); +} + +/*PAGE + * + * _ITRON_Variable_memory_pool_Get + * + * DESCRIPTION: + * + * This function maps variable memory pool IDs to variable memory pool + * control blocks. If ID corresponds to a local variable memory pool, + * then it returns the variable memory pool control pointer which maps + * to ID and location is set to OBJECTS_LOCAL. if the variable memory + * pool ID is global and resides on a remote node, then location is set + * to OBJECTS_REMOTE, and the variable memory pool is undefined. Otherwise, + * location is set to OBJECTS ERROR and the variable memory pool is undefined. + * + * Input parameters: + * id - ITRON variable memory pool ID. + * the_location - pointer to a location variable + * + * Output parameters: + * *the_location - location of the object + */ + +RTEMS_INLINE_ROUTINE ITRON_Variable_memory_pool_Control + *_ITRON_Variable_memory_pool_Get ( + ID id, + Objects_Locations *location +) +{ + return (ITRON_Variable_memory_pool_Control *) _ITRON_Objects_Get( + &_ITRON_Variable_memory_pool_Information, + id, + location + ); +} + +/*PAGE + * + * _ITRON_Variable_memory_pool_Is_null + * + * This function returns TRUE if the_variable_memory_pool is NULL + * and FALSE otherwise. + * + * Input parameters: + * the_variable_memory_pool - pointer to variable memory pool control block + * + * Output parameters: + * TRUE - if the_variable_memory_pool is NULL + * FALSE - otherwise + */ + +RTEMS_INLINE_ROUTINE boolean _ITRON_Variable_memory_pool_Is_null ( + ITRON_Variable_memory_pool_Control *the_variable_memory_pool +) +{ + return ( the_variable_memory_pool == NULL ); +} + +/* + * XXX insert inline routines here + */ + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/c/src/exec/itron/src/Makefile.in b/c/src/exec/itron/src/Makefile.in new file mode 100644 index 0000000000..9cd743e34a --- /dev/null +++ b/c/src/exec/itron/src/Makefile.in @@ -0,0 +1,83 @@ +# +# $Id$ +# + +@SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +top_builddir = .. +subdir = src + +RTEMS_ROOT = @RTEMS_ROOT@ +PROJECT_ROOT = @PROJECT_ROOT@ + +VPATH = @srcdir@ + +TASK_C_PIECES = task cre_tsk del_tsk sta_tsk ext_tsk exd_tsk ter_tsk \ + dis_dsp ena_dsp chg_pri rot_rdq rel_wai get_tid ref_tsk + +TASKSYNC_C_PIECES = sus_tsk rsm_tsk frsm_tsk slp_tsk tslp_tsk wup_tsk \ + can_wup + +SEMAPHORE_C_PIECES = itronsem + +EVENTFLAGS_C_PIECES = eventflags + +MAILBOX_C_PIECES = mbox + +MSGBUFFER_C_PIECES = msgbuffer + +RENDEZVOUS_C_PIECES = port + +INTERRUPT_C_PIECES = itronintr + +VARIABLE_MEMORY_POOL_C_PIECES = vmempool + +FIXED_MEMORY_POOL_C_PIECES = fmempool + +TIME_C_PIECES = itrontime + +CONFIGURATION_C_PIECES = sysmgmt + +NETWORK_C_PIECES = network + +C_PIECES = $(TASK_C_PIECES) $(TASKSYNC_C_PIECES) $(SEMAPHORE_C_PIECES) \ + $(EVENTFLAGS_C_PIECES) $(MAILBOX_C_PIECES) $(MSGBUFFER_C_PIECES) \ + $(RENDEZVOUS_C_PIECES) $(INTERRUPT_C_PIECES) \ + $(VARIABLE_MEMORY_POOL_C_PIECES) $(FIXED_MEMORY_POOL_C_PIECES) \ + $(TIME_C_PIECES) + +C_FILES = $(C_PIECES:%=%.c) +C_O_FILES = $(C_PIECES:%=${ARCH}/%.o) + +SRCS = $(C_FILES) $(CC_FILES) +OBJS = $(C_O_FILES) $(CC_O_FILES) + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(RTEMS_ROOT)/make/lib.cfg + +INSTALL_CHANGE = @INSTALL_CHANGE@ + +# +# Add local stuff here using += +# + +DEFINES += -D__RTEMS_INSIDE__ +CPPFLAGS += +CFLAGS += $(CFLAGS_OS_V) + +# +# Add your list of files to delete here. The config files +# already know how to delete some stuff, so you may want +# to just run 'make clean' first to see what gets missed. +# 'make clobber' already includes 'make clean' +# + +CLEAN_ADDITIONS += +CLOBBER_ADDITIONS += + +all: ${ARCH} $(SRCS) ${OBJS} + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status diff --git a/c/src/exec/itron/src/can_wup.c b/c/src/exec/itron/src/can_wup.c new file mode 100644 index 0000000000..d75d379de9 --- /dev/null +++ b/c/src/exec/itron/src/can_wup.c @@ -0,0 +1,30 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + +/* + * can_wup - Cancel Wakeup Request + */ + +ER can_wup( + INT *p_wupcnt, + ID tskid +) +{ + return E_OK; +} + diff --git a/c/src/exec/itron/src/chg_pri.c b/c/src/exec/itron/src/chg_pri.c new file mode 100644 index 0000000000..b2d42905e5 --- /dev/null +++ b/c/src/exec/itron/src/chg_pri.c @@ -0,0 +1,30 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + +/* + * chg_pri - Change Task Priority + */ + +ER chg_pri( + ID tskid, + PRI tskpri +) +{ + return E_OK; +} + diff --git a/c/src/exec/itron/src/cre_tsk.c b/c/src/exec/itron/src/cre_tsk.c new file mode 100644 index 0000000000..76bcd75eda --- /dev/null +++ b/c/src/exec/itron/src/cre_tsk.c @@ -0,0 +1,127 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + + +/* + * cre_tsk - Create Task + */ + +/* + * XXX - How do I return these errors ??? Do I have to validate the ID + prior to calling the ID routine ?? + E_NOMEM Insufficient memory (Memory for control block and/or user stack + cannot be allocated) + E_ID Invalid ID Number (tskid was invalid or could not be used) + E_RSATR Reserved attribute (tskatr was invalid or could not be used) + E_OBJ Invalid object state (a task of the same ID already exists) + E_OACV Object access violation (A tskid less than -4 was specified from + a user task. This is implementation dependent.) + E_PAR Parameter error (pk_ctsk, task, itskpri and/or stksz is invalid) + EN_OBJNO An object number which could not be accessed on the target node + is specified. + EN_CTXID Specified an object on another node when the system call was + issued from a task in dispatch disabled state or from a task- + independent portion + EN_PAR A value outside the range supported by the target node and/or + transmission packet format was specified as a parameter (a value + outside supported range was specified for exinf, tskatr, task, + itskpri and/or stksz) + */ + +ER cre_tsk( + ID tskid, + T_CTSK *pk_ctsk +) +{ + register Thread_Control *the_thread; + char *name = "trn"; + boolean status; + Priority_Control core_priority; + + /* + * Disable dispatching. + */ + + _Thread_Disable_dispatch(); + + /* + * allocate the thread. + */ + + the_thread = _ITRON_Task_Allocate( tskid ); + if ( !the_thread ) { + ena_dsp(); + return _ITRON_Task_Clarify_allocation_id_error( tskid ); + } + + /* + * XXX - FIX THE VARIABLES TO THE CORRECT VALUES!!! + */ + + /* + * Initialize the core thread for this task. + */ + + core_priority = _ITRON_Task_Priority_to_Core( pk_ctsk->itskpri ); + status = _Thread_Initialize( + &_ITRON_Task_Information, + the_thread, + NULL, + pk_ctsk->stksz, + TRUE, /* XXX - All tasks FP ??? */ + core_priority, + TRUE, + THREAD_CPU_BUDGET_ALGORITHM_EXHAUST_TIMESLICE, + NULL, /* no budget algorithm callout */ + 0, + &name + ); + + if ( !status ) { + _ITRON_Task_Free( the_thread ); + _Thread_Enable_dispatch(); + return -1; +#if (0) +/* XXX */ +#endif + } + +#if (0) /* XXX We have any thing else to set per API structure? */ + api = the_thread->API_Extensions[ THREAD_API_ITRON ]; + asr = &api->Signal; + + asr->is_enabled = FALSE; + + *id = the_thread->Object.id; +#endif + + /* + * This insures we evaluate the process-wide signals pending when we + * first run. + * + * NOTE: Since the thread starts with all unblocked, this is necessary. + */ + + the_thread->do_post_task_switch_extension = TRUE; + + the_thread->Start.entry_point = (Thread_Entry) pk_ctsk->task; + + _Thread_Enable_dispatch(); + return E_OK; +} + diff --git a/c/src/exec/itron/src/del_tsk.c b/c/src/exec/itron/src/del_tsk.c new file mode 100644 index 0000000000..5230acddca --- /dev/null +++ b/c/src/exec/itron/src/del_tsk.c @@ -0,0 +1,50 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + + +/* + * del_tsk - Delete Task + */ + +ER del_tsk( + ID tskid +) +{ + register Thread_Control *the_thread; + Objects_Locations location; + ER result; + + /* XXX - Fix Documentation and error checking for this error on self */ + + the_thread = _ITRON_Task_Get( tskid, &location ); + _Thread_Disable_dispatch(); + + switch ( location ) { + case OBJECTS_REMOTE: + case OBJECTS_ERROR: + _Thread_Enable_dispatch(); + return _ITRON_Task_Clarify_get_id_error( tskid ); + + case OBJECTS_LOCAL: + result = _ITRON_Delete_task( the_thread ); + } + + _Thread_Enable_dispatch(); + return E_OK; +} + diff --git a/c/src/exec/itron/src/dis_dsp.c b/c/src/exec/itron/src/dis_dsp.c new file mode 100644 index 0000000000..348a3d64af --- /dev/null +++ b/c/src/exec/itron/src/dis_dsp.c @@ -0,0 +1,35 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + + +/* + * dis_dsp - Disable Dispatch + */ + +ER dis_dsp( void ) +{ + /* + * Disable dispatch for protection + */ + + _Thread_Disable_dispatch(); + + return E_OK; +} + + diff --git a/c/src/exec/itron/src/ena_dsp.c b/c/src/exec/itron/src/ena_dsp.c new file mode 100644 index 0000000000..7c4d86f4d5 --- /dev/null +++ b/c/src/exec/itron/src/ena_dsp.c @@ -0,0 +1,30 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + + +/* + * ena_dsp - Enable Dispatch + */ + +ER ena_dsp( void ) +{ + _Thread_Enable_dispatch(); + + return E_OK; +} + diff --git a/c/src/exec/itron/src/eventflags.c b/c/src/exec/itron/src/eventflags.c new file mode 100644 index 0000000000..6855593391 --- /dev/null +++ b/c/src/exec/itron/src/eventflags.c @@ -0,0 +1,152 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include + +/* + * _ITRON_Eventflags_Manager_initialization + * + * This routine initializes all event flags manager related data structures. + * + * Input parameters: + * maximum_eventflags - maximum configured eventflags + * + * Output parameters: NONE + */ + +void _ITRON_Eventflags_Manager_initialization( + unsigned32 maximum_eventflags +) +{ + _Objects_Initialize_information( + &_ITRON_Eventflags_Information, /* object information table */ + OBJECTS_ITRON_EVENTFLAGS, /* object class */ + FALSE, /* TRUE if this is a global */ + /* object class */ + maximum_eventflags, /* maximum objects of this class */ + sizeof( ITRON_Eventflags_Control ), /* size of this object's */ + /* control block */ + FALSE, /* TRUE if names for this object */ + /* are strings */ + RTEMS_MAXIMUM_NAME_LENGTH, /* maximum length of each object's */ + /* name */ + FALSE /* TRUE if this class is threads */ + ); + + /* + * Register the MP Process Packet routine. + * + * NOTE: No MP Support YET in RTEMS ITRON implementation. + */ + +} + +/* + * cre_flg - Create Eventflag + */ + +ER cre_flg( + ID flgid, + T_CFLG *pk_cflg +) +{ + return E_OK; +} + +/* + * del_flg - Delete Eventflag + */ + +ER del_flg( + ID flgid +) +{ + return E_OK; +} + +/* + * set_flg - Set Eventflag + */ + +ER set_flg( + ID flgid, + UINT setptn +) +{ + return E_OK; +} + +/* + * clr_flg - Clear Eventflag + */ + +ER clr_flg( + ID flgid, + UINT clrptn +) +{ + return E_OK; +} + +/* + * wai_flg - Wait on Eventflag + */ + +ER wai_flg( + UINT *p_flgptn, + ID flgid, + UINT waiptn, + UINT wfmode +) +{ + return E_OK; +} + +/* + * pol_flg - Wait for Eventflag(Polling) + */ + +ER pol_flg( + UINT *p_flgptn, + ID flgid, + UINT waiptn, + UINT wfmode +) +{ + return E_OK; +} + +/* + * twai_flg - Wait on Eventflag with Timeout + */ + +ER twai_flg( + UINT *p_flgptn, + ID flgid, + UINT waiptn, + UINT wfmode, + TMO tmout +) +{ + return E_OK; +} + +/* + * ref_flg - Reference Eventflag Status + */ + +ER ref_flg( + T_RFLG *pk_rflg, + ID flgid +) +{ + return E_OK; +} + diff --git a/c/src/exec/itron/src/exd_tsk.c b/c/src/exec/itron/src/exd_tsk.c new file mode 100644 index 0000000000..c2b86f3126 --- /dev/null +++ b/c/src/exec/itron/src/exd_tsk.c @@ -0,0 +1,40 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include +#include + +#include +#include +#include +#include +#include + +#include + +/* + * exd_tsk - Exit and Delete Task + */ + +void exd_tsk( void ) +{ + Objects_Information *the_information; + + the_information = _Objects_Get_information( _Thread_Executing->Object.id ); + + /* This should never happen if _Thread_Get() works right */ + assert( the_information ); + + _Thread_Disable_dispatch(); + + _Thread_Set_state( _Thread_Executing, STATES_DORMANT ); + _ITRON_Delete_task( _Thread_Executing ); + + _Thread_Enable_dispatch(); +} + diff --git a/c/src/exec/itron/src/ext_tsk.c b/c/src/exec/itron/src/ext_tsk.c new file mode 100644 index 0000000000..a8a3b0ec23 --- /dev/null +++ b/c/src/exec/itron/src/ext_tsk.c @@ -0,0 +1,27 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + + +/* + * ext_tsk - Exit Issuing Task + */ + +void ext_tsk( void ) +{ + _Thread_Set_state( _Thread_Executing, STATES_DORMANT ); +} diff --git a/c/src/exec/itron/src/fmempool.c b/c/src/exec/itron/src/fmempool.c new file mode 100644 index 0000000000..af4b931791 --- /dev/null +++ b/c/src/exec/itron/src/fmempool.c @@ -0,0 +1,135 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include + +/* + * _ITRON_Fixed_memory_pool_Manager_initialization + * + * This routine initializes all fixed memory pool manager related + * data structures. + * + * Input parameters: + * maximum_fixed_memory_pools - maximum configured fixed memory pools + * + * Output parameters: NONE + */ + +void _ITRON_Fixed_memory_pool_Manager_initialization( + unsigned32 maximum_fixed_memory_pools +) +{ + _Objects_Initialize_information( + &_ITRON_Fixed_memory_pool_Information, /* object information table */ + OBJECTS_ITRON_FIXED_MEMORY_POOLS, /* object class */ + FALSE, /* TRUE if this is a global */ + /* object class */ + maximum_fixed_memory_pools, /* maximum objects of this class */ + sizeof( ITRON_Fixed_memory_pool_Control ), + /* size of this object's control block */ + FALSE, /* TRUE if names for this object */ + /* are strings */ + RTEMS_MAXIMUM_NAME_LENGTH, /* maximum length of each object's */ + /* name */ + FALSE /* TRUE if this class is threads */ + ); + + /* + * Register the MP Process Packet routine. + * + * NOTE: No MP Support YET in RTEMS ITRON implementation. + */ + +} + +/* + * cre_mpf - Create Fixed-Size Memorypool + */ + +ER cre_mpf( + ID mpfid, + T_CMPF *pk_cmpf +) +{ + return E_OK; +} + +/* + * del_mpf - Delete Fixed-Size Memorypool + */ + +ER del_mpf( + ID mpfid +) +{ + return E_OK; +} + +/* + * get_blf - Get Fixed-Size Memory Block + */ + +ER get_blf( + VP *p_blf, + ID mpfid +) +{ + return E_OK; +} + +/* + * pget_blf - Poll and Get Fixed-Size Memory Block + */ + +ER pget_blf( + VP *p_blf, + ID mpfid +) +{ + return E_OK; +} + +/* + * tget_blf - Get Fixed-Size Memory Block with Timeout + */ + +ER tget_blf( + VP *p_blf, + ID mpfid, + TMO tmout +) +{ + return E_OK; +} + +/* + * rel_blf - Release Fixed-Size Memory Block + */ + +ER rel_blf( + ID mpfid, + VP blf +) +{ + return E_OK; +} + +/* + * ref_mpf - Reference Fixed-Size Memorypool Status + */ + +ER ref_mpf( + T_RMPF *pk_rmpf, + ID mpfid +) +{ + return E_OK; +} + diff --git a/c/src/exec/itron/src/frsm_tsk.c b/c/src/exec/itron/src/frsm_tsk.c new file mode 100644 index 0000000000..8fe5e9e6fc --- /dev/null +++ b/c/src/exec/itron/src/frsm_tsk.c @@ -0,0 +1,31 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + + +/* + * frsm_tsk - Forcibly Resume Suspended Task + */ + +ER frsm_tsk( + ID tskid +) +{ + return E_OK; +} + + diff --git a/c/src/exec/itron/src/get_tid.c b/c/src/exec/itron/src/get_tid.c new file mode 100644 index 0000000000..1c5175052a --- /dev/null +++ b/c/src/exec/itron/src/get_tid.c @@ -0,0 +1,29 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + +/* + * get_tid - Get Task Identifier + */ + +ER get_tid( + ID *p_tskid +) +{ + return E_OK; +} + diff --git a/c/src/exec/itron/src/itronintr.c b/c/src/exec/itron/src/itronintr.c new file mode 100644 index 0000000000..14e1d6d67e --- /dev/null +++ b/c/src/exec/itron/src/itronintr.c @@ -0,0 +1,104 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include + +/* + * def_int - Define Interrupt Handler + */ + +ER def_int( + UINT dintno, + T_DINT *pk_dint +) +{ + return E_OK; +} + +/* + * ret_int - Return from Interrupt Handler + */ + +void ret_int( void ) +{ +} + +/* + * ret_wup - Return and Wakeup Task + */ + +void ret_wup( + ID tskid +) +{ +} + +/* + * loc_cpu - Lock CPU + */ + +ER loc_cpu( void ) +{ + return E_OK; +} + +/* + * unl_cpu - Unlock CPU + */ + +ER unl_cpu( void ) +{ + return E_OK; +} + +/* + * dis_int - Disable Interrupt + */ + +ER dis_int( + UINT eintno +) +{ + return E_OK; +} + +/* + * ena_int - Enable Interrupt + */ + +ER ena_int( + UINT eintno +) +{ + return E_OK; +} + +/* + * chg_iXX - Change Interrupt Mask(Level or Priority) + */ + +ER chg_iXX( + UINT iXXXX +) +{ + return E_OK; +} + +/* + * ref_iXX - Reference Interrupt Mask(Level or Priority) + */ + +ER ref_iXX( + UINT *p_iXXXX +) +{ + return E_OK; +} + diff --git a/c/src/exec/itron/src/itronsem.c b/c/src/exec/itron/src/itronsem.c new file mode 100644 index 0000000000..a41775f0f6 --- /dev/null +++ b/c/src/exec/itron/src/itronsem.c @@ -0,0 +1,337 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include + +/* + * _ITRON_Semaphore_Manager_initialization + * + * DESCRIPTION: + * + * This routine initializes all semaphore manager related data structures. + * + * Input parameters: + * maximum_semaphores - maximum configured semaphores + * + * Output parameters: NONE + */ + +void _ITRON_Semaphore_Manager_initialization( + unsigned32 maximum_semaphores +) +{ + _Objects_Initialize_information( + &_ITRON_Semaphore_Information, /* object information table */ + OBJECTS_ITRON_SEMAPHORES, /* object class */ + FALSE, /* TRUE if this is a global */ + /* object class */ + maximum_semaphores, /* maximum objects of this class */ + sizeof( ITRON_Semaphore_Control ), /* size of this object's control block */ + FALSE, /* TRUE if names for this object */ + /* are strings */ + RTEMS_MAXIMUM_NAME_LENGTH, /* maximum length of each object's */ + /* name */ + FALSE /* TRUE if this class is threads */ + ); + + /* + * Register the MP Process Packet routine. + * + * NOTE: No MP Support YET in RTEMS ITRON implementation. + */ + +} + +/* + * cre_sem - Create Semaphore + * + * This function implements the ITRON 3.0 cre_sem() service. + */ + +ER cre_sem( + ID semid, + T_CSEM *pk_csem +) +{ + CORE_semaphore_Attributes the_semaphore_attributes; + ITRON_Semaphore_Control *the_semaphore; + + /* + * Bad pointer to the attributes structure + */ + + if ( !pk_csem ) + return E_PAR; + + /* + * Bits were set that were note defined. + */ + + if ( pk_csem->sematr & _ITRON_SEMAPHORE_UNUSED_ATTRIBUTES ) + return E_RSATR; + + /* + * Initial semaphore count exceeds the maximum. + */ + + if ( pk_csem->isemcnt > pk_csem->maxsem ) + return E_PAR; + + /* + * This error is not in the specification but this condition + * does not make sense. + */ + + if ( pk_csem->maxsem == 0 ) + return E_PAR; + + _Thread_Disable_dispatch(); /* prevents deletion */ + + the_semaphore = _ITRON_Semaphore_Allocate( semid ); + if ( !the_semaphore ) { + _Thread_Enable_dispatch(); + return _ITRON_Semaphore_Clarify_allocation_id_error( semid ); + } + + if ( pk_csem->sematr & TA_TPRI ) + the_semaphore_attributes.discipline = CORE_SEMAPHORE_DISCIPLINES_PRIORITY; + else + the_semaphore_attributes.discipline = CORE_SEMAPHORE_DISCIPLINES_FIFO; + + the_semaphore_attributes.maximum_count = pk_csem->maxsem; + + _CORE_semaphore_Initialize( + &the_semaphore->semaphore, + OBJECTS_ITRON_SEMAPHORES, + &the_semaphore_attributes, + pk_csem->isemcnt, + NULL /* Multiprocessing not supported */ + ); + + _ITRON_Objects_Open( &_ITRON_Semaphore_Information, &the_semaphore->Object ); + + /* + * If multiprocessing were supported, this is where we would announce + * the existence of the semaphore to the rest of the system. + */ + +#if defined(RTEMS_MULTIPROCESSING) +#endif + + _Thread_Enable_dispatch(); + return E_OK; +} + +/* + * del_sem - Delete Semaphore + * + * This function implements the ITRON 3.0 del_sem() service. + */ + +ER del_sem( + ID semid +) +{ + ITRON_Semaphore_Control *the_semaphore; + Objects_Locations location; + + the_semaphore = _ITRON_Semaphore_Get( semid, &location ); + switch ( location ) { + case OBJECTS_REMOTE: /* Multiprocessing not supported */ + case OBJECTS_ERROR: + return _ITRON_Semaphore_Clarify_get_id_error( semid ); + + case OBJECTS_LOCAL: + _CORE_semaphore_Flush( + &the_semaphore->semaphore, + NULL, /* Multiprocessing not supported */ + CORE_SEMAPHORE_WAS_DELETED + ); + + _ITRON_Objects_Close( + &_ITRON_Semaphore_Information, + &the_semaphore->Object + ); + + _ITRON_Semaphore_Free( the_semaphore ); + + /* + * If multiprocessing were supported, this is where we would announce + * the destruction of the semaphore to the rest of the system. + */ + +#if defined(RTEMS_MULTIPROCESSING) +#endif + + _Thread_Enable_dispatch(); + return E_OK; + + } + return E_OK; +} + +/* + * sig_sem - Signal Semaphore + * + * This function implements the ITRON 3.0 sig_sem() service. + */ + +ER sig_sem( + ID semid +) +{ + ITRON_Semaphore_Control *the_semaphore; + Objects_Locations location; + CORE_semaphore_Status status; + + the_semaphore = _ITRON_Semaphore_Get( semid, &location ); + switch ( location ) { + case OBJECTS_REMOTE: /* Multiprocessing not supported */ + case OBJECTS_ERROR: + return _ITRON_Semaphore_Clarify_get_id_error( semid ); + + case OBJECTS_LOCAL: + /* + * XXX maxsemcnt + */ + + status = _CORE_semaphore_Surrender( + &the_semaphore->semaphore, + the_semaphore->Object.id, + NULL /* Multiprocessing not supported */ + ); + _Thread_Enable_dispatch(); + return _ITRON_Semaphore_Translate_core_semaphore_return_code( status ); + } + return E_OK; +} + +/* + * wai_sem - Wait on Semaphore + * + * This function implements the ITRON 3.0 wai_sem() service. + */ + +ER wai_sem( + ID semid +) +{ + return twai_sem( semid, TMO_FEVR ); +} + +/* + * preq_sem - Poll and Request Semaphore + * + * This function implements the ITRON 3.0 preq_sem() service. + */ + +ER preq_sem( + ID semid +) +{ + return twai_sem( semid, TMO_POL ); +} + +/* + * twai_sem - Wait on Semaphore with Timeout + * + * This function implements the ITRON 3.0 twai_sem() service. + */ + +ER twai_sem( + ID semid, + TMO tmout +) +{ + ITRON_Semaphore_Control *the_semaphore; + Objects_Locations location; + Watchdog_Interval interval; + boolean wait; + CORE_semaphore_Status status; + + interval = 0; + if ( tmout == TMO_POL ) { + wait = FALSE; + } else { + wait = TRUE; + if ( tmout != TMO_FEVR ) + interval = TOD_MILLISECONDS_TO_TICKS(tmout); + } + + if ( wait && _ITRON_Is_in_non_task_state() ) + return E_CTX; + + the_semaphore = _ITRON_Semaphore_Get( semid, &location ); + switch ( location ) { + case OBJECTS_REMOTE: /* Multiprocessing not supported */ + case OBJECTS_ERROR: + return _ITRON_Semaphore_Clarify_get_id_error( semid ); + + case OBJECTS_LOCAL: + _CORE_semaphore_Seize( + &the_semaphore->semaphore, + the_semaphore->Object.id, + wait, /* wait for a timeout */ + interval /* timeout value */ + ); + _Thread_Enable_dispatch(); + status = (CORE_semaphore_Status) _Thread_Executing->Wait.return_code; + return _ITRON_Semaphore_Translate_core_semaphore_return_code( status ); + } + return E_OK; +} + +/* + * ref_sem - Reference Semaphore Status + * + * This function implements the ITRON 3.0 ref_sem() service. + */ + +ER ref_sem( + ID semid, + T_RSEM *pk_rsem +) +{ + ITRON_Semaphore_Control *the_semaphore; + Objects_Locations location; + + if ( !pk_rsem ) + return E_PAR; /* XXX check this error code */ + + the_semaphore = _ITRON_Semaphore_Get( semid, &location ); + switch ( location ) { + case OBJECTS_REMOTE: /* Multiprocessing not supported */ + case OBJECTS_ERROR: + return _ITRON_Semaphore_Clarify_get_id_error( semid ); + + case OBJECTS_LOCAL: + /* + * Fill in the current semaphore count + */ + + pk_rsem->semcnt = _CORE_semaphore_Get_count( &the_semaphore->semaphore ); + + /* + * Fill in whether or not there is a waiting task + */ + + if ( !_Thread_queue_First( &the_semaphore->semaphore.Wait_queue ) ) + pk_rsem->wtsk = FALSE; + else + pk_rsem->wtsk = TRUE; + + _Thread_Enable_dispatch(); + return E_OK; + } + return E_OK; +} + diff --git a/c/src/exec/itron/src/itrontime.c b/c/src/exec/itron/src/itrontime.c new file mode 100644 index 0000000000..13621a9e6a --- /dev/null +++ b/c/src/exec/itron/src/itrontime.c @@ -0,0 +1,241 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include + +#include + +/* + * set_tim - Set System Clock + */ + +void converTime(SYSTIME ms, TOD_Control *time) +{ + int millisecond; + +/* XXX need to dereference structure */ +#if 0 + milisecond = ms % 1000; + tempSecond = ms / 1000; +#else + millisecond = 0; +#endif +} + + +/* + * set_tim - Set System Clock + */ + +ER set_tim( + SYSTIME *pk_tim +) +{ + Watchdog_Interval temp; /* an integer in seconds after conversion from SYSTIME */ + TOD_Control the_tod; + +/* convert *pk_tim which is 48 bits integer in binary into an ordinary + integer in milliseconds */ + +/* XXX */ temp = 0; + if(temp > 0) { + _Thread_Disable_dispatch(); + _TOD_Set(&the_tod, temp); + _Thread_Enable_dispatch(); + if(_TOD_Validate(&the_tod)){ + return E_OK; + } + } + return E_SYS; +} + +/* + * get_tim - Get System Clock + */ + +ER get_tim( + SYSTIME *pk_tim +) +{ + return E_OK; +} + +/* + * dly_tsk - Delay Task + */ + +ER dly_tsk( + DLYTIME dlytim +) +{ + Watchdog_Interval ticks; + + ticks = TOD_MILLISECONDS_TO_TICKS(dlytim); + + _Thread_Disable_dispatch(); + if ( ticks == 0 ) { + _Thread_Yield_processor(); + } else { + _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 E_OK; +} + +/* + * def_cyc - Define Cyclic Handler + */ + +ER def_cyc( + HNO cycno, + T_DCYC *pk_dcyc +) +{ + Watchdog_Control *object; +#if 0 + Watchdog_Interval timeInterval; +#endif + +/* XXX */ object = 0; + if ( pk_dcyc->cycatr != TA_HLNG) + return E_RSATR; +#if 0 + timeInterval = pk_dcyc->cyctim / 1000; + object->delta_interval = timeInterval; +#endif + _Watchdog_Initialize( + object, + pk_dcyc->cychdr, + cycno, + pk_dcyc->exinf); + _Watchdog_Deactivate(object); + + return E_OK; +} + +/* + * act_cyc - Activate Cyclic Handler + */ + +ER act_cyc( + HNO cycno, + UINT cycact +) +{ + Watchdog_Control *object; + + if(cycact != TCY_OFF || cycact != TCY_ON) + return E_PAR; + +#if 0 + if( object->Object_ID != cycno) + return E_NOEXS; +#endif + + _Watchdog_Activate(object); + + return E_OK; +} + +/* + * ref_cyc - Reference Cyclic Handler Status + */ + +ER ref_cyc( + T_RCYC *pk_rcyc, + HNO cycno +) +{ +#if 0 + int timeElapse_since_actCyclic; +#endif + T_DCYC *pk_dcyc; +#if 0 + Watchdog_Control *object; +#endif + +/* XXX */ pk_dcyc = 0; + +/* XXX will to use a "get" routine to map from id to object pointer */ +/* XXX and the object pointer should be of type specific to this manager */ +#if 0 + if( object->Object_ID == cycno)) +#else + if ( 1 ) +#endif + { + pk_rcyc->exinf = pk_dcyc->exinf; + pk_rcyc->cycact = pk_dcyc->cycact; +#if 0 + pk_rcyc->lfttim = pk_dcyc->cyctim - timeElapse_since_actCyclic; +#endif + + return E_OK; + } + else + return E_NOEXS; +} + +/* + * def_alm - Define Alarm Handler + */ + +ER def_alm( + HNO almno, + T_DALM *pk_dalm +) +{ +#if 0 + Objects_Control *objectAlrm; + Watchdog_Interval timeInterval; + + timeInterval = pk_dalm->almtim / 1000; + (void) _Watchdog_Remove(&objectAlrm); + _Watchdog_Initialize( + objectAlrm, + pk_dalm->almhdr, + almno, + pk_dalm->exinf); + _Watchdong_Insert_seconds(objectAlrm,timeInterval); + _Thread_Enable_dispatch(); +#endif + + return E_OK; +} + +/* + * ref_alm - Reference Alarm Handler Status + */ + +ER ref_alm( + T_RALM *pk_ralm, + HNO almno +) +{ + + return E_OK; +} + +/* + * ret_tmr - Return from Timer Handler + */ + +void ret_tmr( void ) +{ +} + diff --git a/c/src/exec/itron/src/mbox.c b/c/src/exec/itron/src/mbox.c new file mode 100644 index 0000000000..c2cc11ec31 --- /dev/null +++ b/c/src/exec/itron/src/mbox.c @@ -0,0 +1,133 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include + +/* + * _ITRON_Mailbox_Manager_initialization + * + * This routine initializes all mailboxes manager related data structures. + * + * Input parameters: + * maximum_mailboxes - maximum configured mailboxes + * + * Output parameters: NONE + */ + +void _ITRON_Mailbox_Manager_initialization( + unsigned32 maximum_mailboxes +) +{ + _Objects_Initialize_information( + &_ITRON_Mailbox_Information, /* object information table */ + OBJECTS_ITRON_MAILBOXES, /* object class */ + FALSE, /* TRUE if this is a global */ + /* object class */ + maximum_mailboxes, /* maximum objects of this class */ + sizeof( ITRON_Mailbox_Control ), /* size of this object's control block */ + FALSE, /* TRUE if names for this object */ + /* are strings */ + RTEMS_MAXIMUM_NAME_LENGTH, /* maximum length of each object's */ + /* name */ + FALSE /* TRUE if this class is threads */ + ); + + /* + * Register the MP Process Packet routine. + * + * NOTE: No MP Support YET in RTEMS ITRON implementation. + */ + +} + +/* + * cre_mbx - Create Mailbox + */ + +ER cre_mbx( + ID mbxid, + T_CMBX *pk_cmbx +) +{ + return E_OK; +} + +/* + * del_mbx - Delete Mailbox + */ + +ER del_mbx( + ID mbxid +) +{ + return E_OK; +} + +/* + * snd_msg - Send Message to Mailbox + */ + +ER snd_msg( + ID mbxid, + T_MSG *pk_msg +) +{ + return E_OK; +} + +/* + * rcv_msg - Receive Message from Mailbox + */ + +ER rcv_msg( + T_MSG **ppk_msg, + ID mbxid +) +{ + return E_OK; +} + +/* + * prcv_msg - Poll and Receive Message from Mailbox + */ + +ER prcv_msg( + T_MSG **ppk_msg, + ID mbxid +) +{ + return E_OK; +} + +/* + * trcv_msg - Receive Message from Mailbox with Timeout + */ + +ER trcv_msg( + T_MSG **ppk_msg, + ID mbxid, + TMO tmout +) +{ + return E_OK; +} + +/* + * ref_mbx - Reference Mailbox Status + */ + +ER ref_mbx( + T_RMBX *pk_rmbx, + ID mbxid +) +{ + return E_OK; +} + diff --git a/c/src/exec/itron/src/msgbuffer.c b/c/src/exec/itron/src/msgbuffer.c new file mode 100644 index 0000000000..4711ddbea9 --- /dev/null +++ b/c/src/exec/itron/src/msgbuffer.c @@ -0,0 +1,412 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include + +ER _ITRON_Message_buffer_Translate_core_message_buffer_return_code( + CORE_message_queue_Status status) +{ + switch (status) { + case CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL: + return E_OK; + case CORE_MESSAGE_QUEUE_STATUS_TOO_MANY: + return E_TMOUT; + case CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE: + return E_PAR; + case CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT: + return E_TMOUT; + case CORE_MESSAGE_QUEUE_STATUS_TIMEOUT: + return E_TMOUT; + default: + return E_ID; + } +} + +/* + * _ITRON_Message_buffer_Manager_initialization + * + * This routine initializes all message buffer manager related data + * structures. + * + * Input parameters: + * maximum_message_buffers - maximum configured message buffers + * + * Output parameters: NONE + */ + +void _ITRON_Message_buffer_Manager_initialization( + unsigned32 maximum_message_buffers + ) +{ + _Objects_Initialize_information( + &_ITRON_Message_buffer_Information, /* object information table */ + OBJECTS_ITRON_MESSAGE_BUFFERS, /* object class */ + FALSE, /* TRUE if this is a + global object class */ + maximum_message_buffers, /* maximum objects of this class */ + sizeof( ITRON_Message_buffer_Control ), /* size of this + object's control + block */ + FALSE, /* TRUE if names for this + object are strings */ + RTEMS_MAXIMUM_NAME_LENGTH, /* maximum length of each + object's name */ + FALSE /* TRUE if this class is threads */ + ); + + /* + * Register the MP Process Packet routine. + * + * NOTE: No MP Support YET in RTEMS ITRON implementation. + */ + +} + +/* + * cre_mbf - Create MessageBuffer + */ + +ER cre_mbf( + ID mbfid, + T_CMBF *pk_cmbf + ) +{ + CORE_message_queue_Attributes the_message_queue_attributes; + ITRON_Message_buffer_Control *the_message_buffer; + + /* + * Bad pointer to the attributes structure + */ + + if ( !pk_cmbf ) + return E_PAR; + + /* + * Bits were set that were note defined. + */ + + if (pk_cmbf->mbfatr & ~(TA_TPRI)) + return E_RSATR; + + if (pk_cmbf->bufsz < 0 || pk_cmbf->maxmsz < 0) + return E_PAR; + + if (pk_cmbf->bufsz < pk_cmbf->maxmsz) + return E_PAR; + + _Thread_Disable_dispatch(); /* prevents deletion */ + + the_message_buffer = _ITRON_Message_buffer_Allocate(mbfid); + if ( !the_message_buffer ) { + _Thread_Enable_dispatch(); + return _ITRON_Message_buffer_Clarify_allocation_id_error(mbfid); + } + + if ( pk_cmbf->mbfatr & TA_TPRI ) + the_message_queue_attributes.discipline = + CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY; + else + the_message_queue_attributes.discipline = + CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO; + + _CORE_message_queue_Initialize( + &the_message_buffer->message_queue, + OBJECTS_ITRON_MESSAGE_BUFFERS, + &the_message_queue_attributes, + pk_cmbf->bufsz / pk_cmbf->maxmsz, + pk_cmbf->maxmsz, + NULL /* Multiprocessing not supported */ + ); + + _ITRON_Objects_Open( &_ITRON_Message_buffer_Information, + &the_message_buffer->Object ); + + /* + * If multiprocessing were supported, this is where we would announce + * the existence of the semaphore to the rest of the system. + */ + +#if defined(RTEMS_MULTIPROCESSING) +#endif + + _Thread_Enable_dispatch(); + + return E_OK; +} + +/* + * del_mbf - Delete MessageBuffer + */ + +ER del_mbf( + ID mbfid + ) +{ + ITRON_Message_buffer_Control *the_message_buffer; + Objects_Locations location; + + the_message_buffer = _ITRON_Message_buffer_Get(mbfid, &location); + + switch (location) { + case OBJECTS_REMOTE: + case OBJECTS_ERROR: /* Multiprocessing not supported */ + return _ITRON_Message_buffer_Clarify_get_id_error(mbfid); + + case OBJECTS_LOCAL: + _CORE_message_queue_Flush(&the_message_buffer->message_queue); + _ITRON_Objects_Close( + &_ITRON_Message_buffer_Information, + &the_message_buffer->Object); + _ITRON_Message_buffer_Free(the_message_buffer); + /* + * If multiprocessing were supported, this is where we would announce + * the existence of the semaphore to the rest of the system. + */ + +#if defined(RTEMS_MULTIPROCESSING) +#endif + _Thread_Enable_dispatch(); + return E_OK; + } + + return E_OK; +} + +/* + * snd_mbf - Send Message to MessageBuffer + */ + +ER snd_mbf( + ID mbfid, + VP msg, + INT msgsz + ) +{ + return E_OK; +} + +/* + * psnd_mbf - Poll and Send Message to MessageBuffer + */ + +ER psnd_mbf( + ID mbfid, + VP msg, + INT msgsz + ) +{ + ITRON_Message_buffer_Control *the_message_buffer; + Objects_Locations location; + CORE_message_queue_Status status; + + if (msgsz <= 0 || !msg) + return E_PAR; + + the_message_buffer = _ITRON_Message_buffer_Get(mbfid, &location); + switch (location) { + case OBJECTS_REMOTE: + case OBJECTS_ERROR: /* Multiprocessing not supported */ + return _ITRON_Message_buffer_Clarify_get_id_error(mbfid); + + case OBJECTS_LOCAL: + status = _CORE_message_queue_Submit( + &the_message_buffer->message_queue, + msg, + msgsz, + the_message_buffer->Object.id, + NULL, + CORE_MESSAGE_QUEUE_SEND_REQUEST); + _Thread_Enable_dispatch(); + return + _ITRON_Message_buffer_Translate_core_message_buffer_return_code( + status); + } + + /* + * If multiprocessing were supported, this is where we would announce + * the existence of the semaphore to the rest of the system. + */ + +#if defined(RTEMS_MULTIPROCESSING) +#endif + + return E_OK; +} + +/* + * tsnd_mbf - Send Message to MessageBuffer with Timeout + */ + +ER tsnd_mbf( + ID mbfid, + VP msg, + INT msgsz, + TMO tmout + ) +{ + return E_OK; +} + +/* + * rcv_mbf - Receive Message from MessageBuffer + */ + +ER rcv_mbf( + VP msg, + INT *p_msgsz, + ID mbfid + ) +{ + return trcv_mbf(msg, p_msgsz, mbfid, TMO_FEVR); +} + +/* + * prcv_mbf - Poll and Receive Message from MessageBuffer + */ + +ER prcv_mbf( + VP msg, + INT *p_msgsz, + ID mbfid + ) +{ + return trcv_mbf(msg, p_msgsz, mbfid, TMO_POL); +} + +/* + * trcv_mbf - Receive Message from MessageBuffer with Timeout + */ + +ER trcv_mbf( + VP msg, + INT *p_msgsz, + ID mbfid, + TMO tmout + ) +{ + ITRON_Message_buffer_Control *the_message_buffer; + Objects_Locations location; + CORE_message_queue_Status status; + boolean wait; + Watchdog_Interval interval; + + interval = 0; + if (tmout == TMO_POL) { + wait = FALSE; + } else { + wait = TRUE; + if (tmout != TMO_FEVR) + interval = TOD_MILLISECONDS_TO_TICKS(tmout); + } + + if (wait && _ITRON_Is_in_non_task_state() ) + return E_CTX; + + if (!p_msgsz || !msg || tmout <= -2) + return E_PAR; + + the_message_buffer = _ITRON_Message_buffer_Get(mbfid, &location); + switch (location) { + case OBJECTS_REMOTE: + case OBJECTS_ERROR: /* Multiprocessing not supported */ + return _ITRON_Message_buffer_Clarify_get_id_error(mbfid); + + case OBJECTS_LOCAL: + _CORE_message_queue_Seize( + &the_message_buffer->message_queue, + the_message_buffer->Object.id, + msg, + p_msgsz, + wait, + interval); + _Thread_Enable_dispatch(); + status = + (CORE_message_queue_Status)_Thread_Executing->Wait.return_code; + return + _ITRON_Message_buffer_Translate_core_message_buffer_return_code + (status); + + } + + /* + * If multiprocessing were supported, this is where we would announce + * the existence of the semaphore to the rest of the system. + */ + +#if defined(RTEMS_MULTIPROCESSING) +#endif + return E_OK; +} + +/* + * ref_mbf - Reference MessageBuffer Status + */ + +ER ref_mbf( + T_RMBF *pk_rmbf, + ID mbfid + ) +{ + ITRON_Message_buffer_Control *the_message_buffer; + Objects_Locations location; + + if ( !pk_rmbf ) + return E_PAR; /* XXX check this error code */ + + the_message_buffer = _ITRON_Message_buffer_Get( mbfid, &location ); + switch ( location ) { + case OBJECTS_REMOTE: /* Multiprocessing not supported */ + case OBJECTS_ERROR: + return _ITRON_Message_buffer_Clarify_get_id_error( mbfid ); + + case OBJECTS_LOCAL: + /* + * Fill in the size of message to be sent + */ + + if(the_message_buffer->message_queue. + number_of_pending_messages == 0) { + pk_rmbf->msgsz = 0; + } + else { + CORE_message_queue_Buffer_control *the_message; + the_message = (CORE_message_queue_Buffer_control*) + the_message_buffer->message_queue. + Pending_messages.first; + pk_rmbf->msgsz = the_message->Contents.size; + } + + /* + * Fill in the size of free buffer + */ + + pk_rmbf->frbufsz = + (the_message_buffer->message_queue.maximum_pending_messages- + the_message_buffer->message_queue.number_of_pending_messages)* + the_message_buffer->message_queue.maximum_message_size; + + + /* + * Fill in whether or not there is a waiting task + */ + + if ( !_Thread_queue_First( + &the_message_buffer->message_queue.Wait_queue ) ) + pk_rmbf->wtsk = FALSE; + else + pk_rmbf->wtsk = TRUE; + + pk_rmbf->stsk = FALSE; + _Thread_Enable_dispatch(); + return E_OK; + } + return E_OK; +} diff --git a/c/src/exec/itron/src/network.c b/c/src/exec/itron/src/network.c new file mode 100644 index 0000000000..82a57ac1a1 --- /dev/null +++ b/c/src/exec/itron/src/network.c @@ -0,0 +1,65 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include + +/* + * nrea_dat - Read Data from another Node + */ + +ER nrea_dat( + INT *p_reasz, + VP dstadr, + NODE srcnode, + VP srcadr, + INT datsz +) +{ + return E_OK; +} + +/* + * nwri_dat - Write Data to another Node + */ + +ER nwri_dat( + INT *p_wrisz, + NODE dstnode, + VP dstadr, + VP srcadr, + INT datsz +) +{ + return E_OK; +} + +/* + * nget_nod - Get Local Node Number + */ + +ER nget_nod( + NODE *p_node +) +{ + return E_OK; +} + +/* + * nget_ver - Get Version Information of another Node + */ + +ER nget_ver( + T_VER *pk_ver, + NODE node +) +{ + return E_OK; +} + diff --git a/c/src/exec/itron/src/port.c b/c/src/exec/itron/src/port.c new file mode 100644 index 0000000000..4d95638f7b --- /dev/null +++ b/c/src/exec/itron/src/port.c @@ -0,0 +1,202 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include + +/* + * _ITRON_Port_Manager_initialization + * + * This routine initializes all ports manager related data structures. + * + * Input parameters: + * maximum_ports - maximum configured ports + * + * Output parameters: NONE + */ + +void _ITRON_Port_Manager_initialization( + unsigned32 maximum_ports +) +{ + _Objects_Initialize_information( + &_ITRON_Port_Information, /* object information table */ + OBJECTS_ITRON_PORTS, /* object class */ + FALSE, /* TRUE if this is a global object class */ + maximum_ports, /* maximum objects of this class */ + sizeof( ITRON_Port_Control ), /* size of this object's control block */ + FALSE, /* TRUE if names for this object */ + /* are strings */ + RTEMS_MAXIMUM_NAME_LENGTH, /* maximum length of each object's name */ + FALSE /* TRUE if this class is threads */ + ); + + /* + * Register the MP Process Packet routine. + * + * NOTE: No MP Support YET in RTEMS ITRON implementation. + */ + +} + +/* + * cre_por - Create Port for Rendezvous + */ + +ER cre_por( + ID porid, + T_CPOR *pk_cpor +) +{ + return E_OK; +} + +/* + * del_por - Delete Port for Rendezvous + */ + +ER del_por( + ID porid +) +{ + return E_OK; +} + +/* + * cal_por - Call Port for Rendezvous Poll + */ + +ER cal_por( + VP msg, + INT *p_rmsgsz, + ID porid, + UINT calptn, + INT cmsgsz +) +{ + return E_OK; +} + +/* + * pcal_por - Poll and Call Port for Rendezvous + */ + +ER pcal_por( + VP msg, + INT *p_rmsgsz, + ID porid, + UINT calptn, + INT cmsgsz +) +{ + return E_OK; +} + +/* + * tcal_por - Call Port for Rendezvous with Timeout + */ + +ER tcal_por( + VP msg, + INT *p_rmsgsz, + ID porid, + UINT calptn, + INT cmsgsz, + TMO tmout +) +{ + return E_OK; +} + +/* + * acp_por - Accept Port for Rendezvous Poll + */ + +ER acp_por( + RNO *p_rdvno, + VP msg, + INT *p_cmsgsz, + ID porid, + UINT acpptn +) +{ + return E_OK; +} + +/* + * pacp_por - Poll and Accept Port for Rendezvous + */ + +ER pacp_por( + RNO *p_rdvno, + VP msg, + INT *p_cmsgsz, + ID porid, + UINT acpptn +) +{ + return E_OK; +} + +/* + * tacp_por - Accept Port for Rendezvous with Timeout + */ + +ER tacp_por( + RNO *p_rdvno, + VP msg, + INT *p_cmsgsz, + ID porid, + UINT acpptn, + TMO tmout +) +{ + return E_OK; +} + +/* + * fwd_por - Forward Rendezvous to Other Port + */ + +ER fwd_por( + ID porid, + UINT calptn, + RNO rdvno, + VP msg, + INT cmsgsz +) +{ + return E_OK; +} + +/* + * rpl_rdv - Reply Rendezvous + */ + +ER rpl_rdv( + RNO rdvno, + VP msg, + INT rmsgsz +) +{ + return E_OK; +} + +/* + * ref_por - Reference Port Status + */ + +ER ref_por( + T_RPOR *pk_rpor, + ID porid +) +{ + return E_OK; +} + diff --git a/c/src/exec/itron/src/ref_tsk.c b/c/src/exec/itron/src/ref_tsk.c new file mode 100644 index 0000000000..50ce76e8ed --- /dev/null +++ b/c/src/exec/itron/src/ref_tsk.c @@ -0,0 +1,31 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + + +/* + * ref_tsk - Reference Task Status + */ + +ER ref_tsk( + T_RTSK *pk_rtsk, + ID tskid +) +{ + return E_OK; +} + diff --git a/c/src/exec/itron/src/rel_wai.c b/c/src/exec/itron/src/rel_wai.c new file mode 100644 index 0000000000..390433ec0c --- /dev/null +++ b/c/src/exec/itron/src/rel_wai.c @@ -0,0 +1,30 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + +/* + * rel_wai - Release Wait of Other Task + */ + +ER rel_wai( + ID tskid +) +{ + return E_OK; +} + + diff --git a/c/src/exec/itron/src/rot_rdq.c b/c/src/exec/itron/src/rot_rdq.c new file mode 100644 index 0000000000..b329313946 --- /dev/null +++ b/c/src/exec/itron/src/rot_rdq.c @@ -0,0 +1,30 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + +/* + * rot_rdq - Rotate Tasks on the Ready Queue + */ + +ER rot_rdq( + PRI tskpri +) +{ + return E_OK; +} + + diff --git a/c/src/exec/itron/src/rsm_tsk.c b/c/src/exec/itron/src/rsm_tsk.c new file mode 100644 index 0000000000..a19842f8da --- /dev/null +++ b/c/src/exec/itron/src/rsm_tsk.c @@ -0,0 +1,30 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + + +/* + * rsm_tsk - Resume Suspended Task + */ + +ER rsm_tsk( + ID tskid +) +{ + return E_OK; +} + diff --git a/c/src/exec/itron/src/slp_tsk.c b/c/src/exec/itron/src/slp_tsk.c new file mode 100644 index 0000000000..00562dda92 --- /dev/null +++ b/c/src/exec/itron/src/slp_tsk.c @@ -0,0 +1,28 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + + + +/* + * slp_tsk - Sleep Task Sleep Task with Timeout + */ + +ER slp_tsk( void ) +{ + return E_OK; +} diff --git a/c/src/exec/itron/src/sta_tsk.c b/c/src/exec/itron/src/sta_tsk.c new file mode 100644 index 0000000000..91a6586c0e --- /dev/null +++ b/c/src/exec/itron/src/sta_tsk.c @@ -0,0 +1,84 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + + +/* + * sta_tsk - Start Task + */ + +/* + * XXX - How Do I know when these happen ??? + E_NOEXS Object does not exist (the task specified by tskid does not exist) + E_OACV Object access violation (A tskid less than -4 was specified from + a user task. This is implementation dependent.) + E_OBJ Invalid object state (the target task is not in DORMANT state) + EN_OBJNO An object number which could not be accessed on the target node + is specified. XXX Should never get on a single processor?? + EN_CTXID Specified an object on another node when the system call was + issued from a task in dispatch disabled state or from a task- + independent portionXXX Should never get on a single processor?? + EN_PAR A value outside the range supported by the target node and/or + transmission packet format was specified as a parameter (a value + outside supported range was specified for stacd) +XXX- What does _ITRON_Task_Get return on an invalid id and how do you know + if it is E_ID, E_NOEXS, E_OACV +*/ + +ER sta_tsk( + ID tskid, + INT stacd +) +{ + register Thread_Control *the_thread; + Objects_Locations location; + boolean status; + + the_thread = _ITRON_Task_Get( tskid, &location ); + switch ( location ) { + case OBJECTS_REMOTE: + case OBJECTS_ERROR: + return E_ID; /* XXX */ + + case OBJECTS_LOCAL: + status = _Thread_Start( + the_thread, + THREAD_START_NUMERIC, /* XXX should be able to say we have no arg */ + the_thread->Start.entry_point, + 0, /* XXX supercore forces us to have an arg */ + 0 /* unused */ + ); + + /* + * Wrong state XXX + */ + + if ( !status ) { + _Thread_Enable_dispatch(); + return E_OBJ; + } + + _Thread_Enable_dispatch(); + return E_OK; + } + + return E_OBJ; /* unreached - only to remove warnings */ +} + + + + diff --git a/c/src/exec/itron/src/sus_tsk.c b/c/src/exec/itron/src/sus_tsk.c new file mode 100644 index 0000000000..f4a5d5b851 --- /dev/null +++ b/c/src/exec/itron/src/sus_tsk.c @@ -0,0 +1,34 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + + +/* + * Task-Dependent Synchronization Functions + */ + +/* + * sus_tsk - Suspend Other Task + */ + +ER sus_tsk( + ID tskid +) +{ + return E_OK; +} + diff --git a/c/src/exec/itron/src/sysmgmt.c b/c/src/exec/itron/src/sysmgmt.c new file mode 100644 index 0000000000..24d9075154 --- /dev/null +++ b/c/src/exec/itron/src/sysmgmt.c @@ -0,0 +1,69 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include + +/* + * get_ver - Get Version Information + */ + +ER get_ver( + T_VER *pk_ver +) +{ + return E_OK; +} + +/* + * ref_sys - Reference System Status + */ + +ER ref_sys( + T_RSYS *pk_rsys +) +{ + return E_OK; +} + +/* + * ref_cfg - Reference Configuration Information + */ + +ER ref_cfg( + T_RCFG *pk_rcfg +) +{ + return E_OK; +} + +/* + * def_svc - Define Extended SVC Handler + */ + +ER def_svc( + FN s_fncd, + T_DSVC *pk_dsvc +) +{ + return E_OK; +} + +/* + * def_exc - Define Exception Handler + */ + +ER def_exc( + UINT exckind, + T_DEXC *pk_dexc +) +{ + return E_OK; +} + diff --git a/c/src/exec/itron/src/task.c b/c/src/exec/itron/src/task.c new file mode 100644 index 0000000000..f646b29d49 --- /dev/null +++ b/c/src/exec/itron/src/task.c @@ -0,0 +1,217 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + +/* + * _ITRON_Task_Create_extension + * + * This routine is an extension routine that is invoked as part + * of creating any type of task or thread in the system. If the + * task is created via another API, then this routine is invoked + * and this API given the opportunity to initialize its extension + * area. + */ + +boolean _ITRON_Task_Create_extension( + Thread_Control *executing, + Thread_Control *created +) +{ + ITRON_API_Control *api; + + api = _Workspace_Allocate( sizeof( ITRON_API_Control ) ); + + if ( !api ) + return FALSE; + + created->API_Extensions[ THREAD_API_ITRON ] = api; + + /* + * Initialize the ITRON API extension + */ + + return TRUE; +} + +/* + * _ITRON_Task_Delete_extension + * + * This extension routine is invoked when a task is deleted. + */ + +User_extensions_routine _ITRON_Task_Delete_extension( + Thread_Control *executing, + Thread_Control *deleted +) +{ + (void) _Workspace_Free( deleted->API_Extensions[ THREAD_API_ITRON ] ); + + deleted->API_Extensions[ THREAD_API_ITRON ] = NULL; +} + +/* + * _ITRON_Task_Initialize_user_tasks + * + * This routine creates and starts all configured user + * initialzation threads. + */ + +void _ITRON_Task_Initialize_user_tasks( void ) +{ + unsigned32 index; + unsigned32 maximum; + ER return_value; + itron_initialization_tasks_table *user_tasks; + + /* + * NOTE: This is slightly different from the Ada implementation. + */ + + user_tasks = _ITRON_Task_User_initialization_tasks; + maximum = _ITRON_Task_Number_of_initialization_tasks; + + if ( !user_tasks || maximum == 0 ) + return; + + for ( index=0 ; index < maximum ; index++ ) { + + return_value = cre_tsk( + user_tasks[ index ].id, + &user_tasks[ index ].attributes + ); + + if ( return_value != E_OK ) + _Internal_error_Occurred( INTERNAL_ERROR_ITRON_API, TRUE, return_value ); + + return_value = sta_tsk( user_tasks[ index ].id, 0 ); + + if ( return_value != E_OK ) + _Internal_error_Occurred( INTERNAL_ERROR_ITRON_API, TRUE, return_value ); + + } +} + +/*PAGE + * + * _ITRON_Delete_task + */ + +ER _ITRON_Delete_task( + Thread_Control *the_thread +) +{ + Objects_Information *the_information; + + the_information = _Objects_Get_information( the_thread->Object.id ); + + if ( !the_information ) { + return -1; /* XXX */ + /* This should never happen if _Thread_Get() works right */ + } + + _Thread_Close( the_information, the_thread ); + + _ITRON_Task_Free( the_thread ); + + return E_OK; +} + +/* + * At this point in time, the ITRON API does not need any other + * extensions. See the POSIX and RTEMS API extensions for + * examples of how they can be used. + */ + +/* + * Extension Tables + */ + +API_extensions_Control _ITRON_Task_API_extensions = { + { NULL, NULL }, + NULL, /* predriver */ + _ITRON_Task_Initialize_user_tasks, /* postdriver */ + NULL /* post switch */ +}; + +User_extensions_Control _ITRON_Task_User_extensions = { + { NULL, NULL }, + { _ITRON_Task_Create_extension, /* create */ + NULL, /* start */ + NULL, /* restart */ + _ITRON_Task_Delete_extension, /* delete */ + NULL, /* switch */ + NULL, /* begin */ + NULL, /* exitted */ + NULL /* fatal */ + } +}; + +/* + * _ITRON_Task_Manager_initialization + * + * This routine initializes all Task Manager related data structures. + * + * Input parameters: + * maximum_tasks - number of tasks to initialize + * + * Output parameters: NONE + */ + +void _ITRON_Task_Manager_initialization( + unsigned32 maximum_tasks, + unsigned32 number_of_initialization_tasks, + itron_initialization_tasks_table *user_tasks +) +{ + + _ITRON_Task_Number_of_initialization_tasks = number_of_initialization_tasks; + _ITRON_Task_User_initialization_tasks = user_tasks; + + /* + * There may not be any ITRON_initialization tasks configured. + */ + +#if 0 + if ( user_tasks == NULL || number_of_initialization_tasks == 0 ) + _Internal_error_Occurred( INTERNAL_ERROR_ITRON_API, TRUE, -1 ); +#endif + + _Objects_Initialize_information( + &_ITRON_Task_Information, /* object information table */ + OBJECTS_ITRON_TASKS, /* object class */ + FALSE, /* TRUE if this is a global object class */ + maximum_tasks, /* maximum objects of this class */ + sizeof( Thread_Control ), /* size of this object's control block */ + FALSE, /* TRUE if names for this object are strings */ + ITRON_MAXIMUM_NAME_LENGTH, /* maximum length of each object's name */ + TRUE /* TRUE if this class is threads */ + ); + + /* + * Add all the extensions for this API + */ + + _User_extensions_Add_API_set( &_ITRON_Task_User_extensions ); + + _API_extensions_Add( &_ITRON_Task_API_extensions ); + + /* + * XXX MP not supported + * Register the MP Process Packet routine. + */ + +} diff --git a/c/src/exec/itron/src/ter_tsk.c b/c/src/exec/itron/src/ter_tsk.c new file mode 100644 index 0000000000..c0d05c1fec --- /dev/null +++ b/c/src/exec/itron/src/ter_tsk.c @@ -0,0 +1,30 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + + +/* + * ter_tsk - Terminate Other Task + */ + +ER ter_tsk( + ID tskid +) +{ + return E_OK; +} + diff --git a/c/src/exec/itron/src/tslp_tsk.c b/c/src/exec/itron/src/tslp_tsk.c new file mode 100644 index 0000000000..b8556f0f68 --- /dev/null +++ b/c/src/exec/itron/src/tslp_tsk.c @@ -0,0 +1,31 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + + +/* + * tslp_tsk - Sleep Task with Timeout + */ + +ER tslp_tsk( + TMO tmout +) +{ + return E_OK; +} + + diff --git a/c/src/exec/itron/src/vmempool.c b/c/src/exec/itron/src/vmempool.c new file mode 100644 index 0000000000..726d9c8c68 --- /dev/null +++ b/c/src/exec/itron/src/vmempool.c @@ -0,0 +1,138 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include + +/* + * _ITRON_Variable_memory_pool_Manager_initialization + * + * This routine initializes all variable memory pool manager related + * data structures. + * + * Input parameters: + * maximum_variable_memory_pools - maximum configured variable memory pools + * + * Output parameters: NONE + */ + +void _ITRON_Variable_memory_pool_Manager_initialization( + unsigned32 maximum_variable_memory_pools +) +{ + _Objects_Initialize_information( + &_ITRON_Variable_memory_pool_Information, /* object information table */ + OBJECTS_ITRON_VARIABLE_MEMORY_POOLS, /* object class */ + FALSE, /* TRUE if this is a global */ + /* object class */ + maximum_variable_memory_pools, /* maximum objects of this class */ + sizeof( ITRON_Variable_memory_pool_Control ), + /* size of this object's control block */ + FALSE, /* TRUE if names for this object */ + /* are strings */ + RTEMS_MAXIMUM_NAME_LENGTH, /* maximum length of each object's */ + /* name */ + FALSE /* TRUE if this class is threads */ + ); + + /* + * Register the MP Process Packet routine. + * + * NOTE: No MP Support YET in RTEMS ITRON implementation. + */ + +} + +/* + * cre_mpl - Create Variable-Size Memorypool + */ + +ER cre_mpl( + ID mplid, + T_CMPL *pk_cmpl +) +{ + return E_OK; +} + +/* + * del_mpl - Delete Variable-Size Memorypool + */ + +ER del_mpl( + ID mplid +) +{ + return E_OK; +} + +/* + * get_blk - Get Variable-Size Memory Block + */ + +ER get_blk( + VP *p_blk, + ID mplid, + INT blksz +) +{ + return E_OK; +} + +/* + * pget_blk - Poll and Get Variable-Size Memory Block + */ + +ER pget_blk( + VP *p_blk, + ID mplid, + INT blksz +) +{ + return E_OK; +} + +/* + * tget_blk - Get Variable-Size Memory Block with Timeout + */ + +ER tget_blk( + VP *p_blk, + ID mplid, + INT blksz, + TMO tmout +) +{ + return E_OK; +} + +/* + * rel_blk - Release Variable-Size Memory Block + */ + +ER rel_blk( + ID mplid, + VP blk +) +{ + return E_OK; +} + +/* + * ref_mpl - Reference Variable-Size Memorypool Status + */ + +ER ref_mpl( + T_RMPL *pk_rmpl, + ID mplid +) +{ + return E_OK; +} + diff --git a/c/src/exec/itron/src/wup_tsk.c b/c/src/exec/itron/src/wup_tsk.c new file mode 100644 index 0000000000..bc0ca0edb9 --- /dev/null +++ b/c/src/exec/itron/src/wup_tsk.c @@ -0,0 +1,30 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + + +/* + * wup_tsk - Wakeup Other Task + */ + +ER wup_tsk( + ID tskid +) +{ + return E_OK; +} + diff --git a/c/src/exec/posix/Makefile.am b/c/src/exec/posix/Makefile.am index a3204d5b9c..6de0e0c27e 100644 --- a/c/src/exec/posix/Makefile.am +++ b/c/src/exec/posix/Makefile.am @@ -5,7 +5,7 @@ AUTOMAKE_OPTIONS = foreign 1.4 ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal -SUBDIRS = include inline macros optman src +SUBDIRS = include inline macros src include $(top_srcdir)/../../../../automake/subdirs.am include $(top_srcdir)/../../../../automake/local.am diff --git a/c/src/exec/posix/configure.in b/c/src/exec/posix/configure.in index 1d3b214ee5..3ca21f4d9c 100644 --- a/c/src/exec/posix/configure.in +++ b/c/src/exec/posix/configure.in @@ -14,6 +14,7 @@ AM_MAINTAINER_MODE RTEMS_ENABLE_MULTIPROCESSING RTEMS_ENABLE_POSIX +RTEMS_ENABLE_POSIX RTEMS_ENABLE_INLINES RTEMS_ENV_RTEMSBSP diff --git a/c/src/exec/sapi/include/confdefs.h b/c/src/exec/sapi/include/confdefs.h index e2a0c84d3d..152ae790df 100644 --- a/c/src/exec/sapi/include/confdefs.h +++ b/c/src/exec/sapi/include/confdefs.h @@ -29,6 +29,9 @@ extern rtems_multiprocessing_table Multiprocessing_configuration; #ifdef RTEMS_POSIX_API extern posix_api_configuration_table Configuration_POSIX_API; #endif +#ifdef RTEMS_ITRON_API +extern itron_api_configuration_table Configuration_ITRON_API; +#endif /* * RTEMS C Library and Newlib support @@ -508,6 +511,184 @@ posix_initialization_threads_table POSIX_Initialization_threads[] = { #define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE 0 #endif +/* + * ITRON API Configuration Parameters + */ + +#ifdef RTEMS_ITRON_API + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef CONFIGURE_MAXIMUM_ITRON_TASKS +#define CONFIGURE_MAXIMUM_ITRON_TASKS 10 +#endif + +#ifndef CONFIGURE_MAXIMUM_ITRON_SEMAPHORES +#define CONFIGURE_MAXIMUM_ITRON_SEMAPHORES 0 +#endif + +#ifndef CONFIGURE_MAXIMUM_ITRON_EVENTFLAGS +#define CONFIGURE_MAXIMUM_ITRON_EVENTFLAGS 0 +#endif + +#ifndef CONFIGURE_MAXIMUM_ITRON_MAILBOXES +#define CONFIGURE_MAXIMUM_ITRON_MAILBOXES 0 +#endif + +#ifndef CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS +#define CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS 0 +#endif + +#ifndef CONFIGURE_MAXIMUM_ITRON_PORTS +#define CONFIGURE_MAXIMUM_ITRON_PORTS 0 +#endif + +#ifndef CONFIGURE_MAXIMUM_ITRON_MEMORY_POOLS +#define CONFIGURE_MAXIMUM_ITRON_MEMORY_POOLS 0 +#endif + +#ifndef CONFIGURE_MAXIMUM_ITRON_FIXED_MEMORY_POOLS +#define CONFIGURE_MAXIMUM_ITRON_FIXED_MEMORY_POOLS 0 +#endif + +#ifdef CONFIGURE_ITRON_INIT_TASK_TABLE + +#ifdef CONFIGURE_ITRON_HAS_OWN_INIT_TASK_TABLE + +/* + * The user is defining their own table information and setting the + * appropriate variables. + */ + +#else + +#ifndef CONFIGURE_ITRON_INIT_TASK_ENTRY_POINT +#define CONFIGURE_ITRON_INIT_TASK_ENTRY_POINT ITRON_Init +#endif + +#ifndef CONFIGURE_ITRON_INIT_TASK_ATTRIBUTES +#define CONFIGURE_ITRON_INIT_TASK_ATTRIBUTES TA_HLNG +#endif + +#ifndef CONFIGURE_ITRON_INIT_TASK_PRIORITY +#define CONFIGURE_ITRON_INIT_TASK_PRIORITY 1 +#endif + +#ifndef CONFIGURE_ITRON_INIT_TASK_STACK_SIZE +#define CONFIGURE_ITRON_INIT_TASK_STACK_SIZE RTEMS_MINIMUM_STACK_SIZE +#endif + +#ifdef CONFIGURE_INIT +itron_initialization_tasks_table ITRON_Initialization_tasks[] = { + { 1, /* ID */ + { (VP) 0, /* exinfo */ + CONFIGURE_ITRON_INIT_TASK_ATTRIBUTES, /* task attributes */ + CONFIGURE_ITRON_INIT_TASK_ENTRY_POINT, /* task start address */ + CONFIGURE_ITRON_INIT_TASK_PRIORITY, /* initial task priority */ + CONFIGURE_ITRON_INIT_TASK_STACK_SIZE /* stack size */ + } + } +}; +#endif + +#define CONFIGURE_ITRON_INIT_TASK_TABLE_NAME ITRON_Initialization_tasks + +#define CONFIGURE_ITRON_INIT_TASK_TABLE_SIZE \ + sizeof(CONFIGURE_ITRON_INIT_TASK_TABLE_NAME) / \ + sizeof(itron_initialization_tasks_table) + +#endif /* CONFIGURE_ITRON_HAS_OWN_INIT_TASK_TABLE */ + +#else /* CONFIGURE_ITRON_INIT_TASK_TABLE */ + +#define CONFIGURE_ITRON_INIT_TASK_TABLE_NAME NULL +#define CONFIGURE_ITRON_INIT_TASK_TABLE_SIZE 0 + +#endif + +#define CONFIGURE_MEMORY_PER_TASK_FOR_ITRON_API \ + ( \ + sizeof (ITRON_API_Control) \ + ) + +#define CONFIGURE_MEMORY_FOR_ITRON_SEMAPHORES(_semaphores) \ + ((_semaphores) * \ + ( sizeof(ITRON_Semaphore_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) ) + +#define CONFIGURE_MEMORY_FOR_ITRON_EVENTFLAGS(_eventflags) \ + ((_eventflags) * \ + ( sizeof(ITRON_Eventflags_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) ) + +#define CONFIGURE_MEMORY_FOR_ITRON_MAILBOXES(_mailboxes) \ + ((_mailboxes) * \ + ( sizeof(ITRON_Mailbox_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) ) + +#define CONFIGURE_MEMORY_FOR_ITRON_MESSAGE_BUFFERS(_message_buffers) \ + ((_message_buffers) * \ + ( sizeof(ITRON_Message_buffer_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) ) + +#define CONFIGURE_MEMORY_FOR_ITRON_PORTS(_ports) \ + ((_ports) * \ + ( sizeof(ITRON_Port_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) ) + +#define CONFIGURE_MEMORY_FOR_ITRON_MEMORY_POOLS(_memory_pools) \ + ((_memory_pools) * \ + (sizeof(ITRON_Variable_memory_pool_Control) + CONFIGURE_OBJECT_TABLE_STUFF)) + +#define CONFIGURE_MEMORY_FOR_ITRON_FIXED_MEMORY_POOLS(_fixed_memory_pools) \ + ((_fixed_memory_pools) * \ + ( sizeof(ITRON_Fixed_memory_pool_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) ) + +#ifndef CONFIGURE_ITRON_INIT_TASK_STACK_SIZES +#define CONFIGURE_ITRON_INIT_TASK_STACK_SIZES (RTEMS_MINIMUM_STACK_SIZE * 2) +#endif + + +#define CONFIGURE_MEMORY_FOR_ITRON \ + ( \ + CONFIGURE_MEMORY_FOR_ITRON_SEMAPHORES( \ + CONFIGURE_MAXIMUM_ITRON_SEMAPHORES ) + \ + CONFIGURE_MEMORY_FOR_ITRON_EVENTFLAGS( \ + CONFIGURE_MAXIMUM_ITRON_EVENTFLAGS ) + \ + CONFIGURE_MEMORY_FOR_ITRON_MAILBOXES( \ + CONFIGURE_MAXIMUM_ITRON_MAILBOXES ) + \ + CONFIGURE_MEMORY_FOR_ITRON_MESSAGE_BUFFERS( \ + CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS ) + \ + CONFIGURE_MEMORY_FOR_ITRON_PORTS( \ + CONFIGURE_MAXIMUM_ITRON_PORTS ) + \ + CONFIGURE_MEMORY_FOR_ITRON_MEMORY_POOLS( \ + CONFIGURE_MAXIMUM_ITRON_MEMORY_POOLS ) + \ + CONFIGURE_MEMORY_FOR_ITRON_FIXED_MEMORY_POOLS( \ + CONFIGURE_MAXIMUM_ITRON_FIXED_MEMORY_POOLS ) + \ + CONFIGURE_ITRON_INIT_TASK_STACK_SIZES \ + ) + + +#else + +#define CONFIGURE_MAXIMUM_ITRON_TASKS 0 +#define CONFIGURE_MAXIMUM_ITRON_SEMAPHORES 0 +#define CONFIGURE_MAXIMUM_ITRON_EVENTFLAGS 0 +#define CONFIGURE_MAXIMUM_ITRON_MAILBOXES 0 +#define CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS 0 +#define CONFIGURE_MAXIMUM_ITRON_PORTS 0 +#define CONFIGURE_MAXIMUM_ITRON_MEMORY_POOLS 0 +#define CONFIGURE_MAXIMUM_ITRON_FIXED_MEMORY_POOLS 0 +#define CONFIGURE_MEMORY_PER_TASK_FOR_ITRON_API 0 +#define CONFIGURE_MEMORY_FOR_ITRON 0 + +#endif /* RTEMS_ITRON_API */ + + /* * Calculate the RAM size based on the maximum number of objects configured. * The model is to estimate the memory required for each configured item, @@ -538,6 +719,7 @@ posix_initialization_threads_table POSIX_Initialization_threads[] = { ((sizeof(Thread_Control) + CONTEXT_FP_SIZE + \ STACK_MINIMUM_SIZE + sizeof( RTEMS_API_Control ) + \ CONFIGURE_MEMORY_PER_TASK_FOR_POSIX_API + \ + CONFIGURE_MEMORY_PER_TASK_FOR_ITRON_API + \ CONFIGURE_OBJECT_TABLE_STUFF)) \ ) @@ -616,8 +798,10 @@ posix_initialization_threads_table POSIX_Initialization_threads[] = { #define CONFIGURE_EXECUTIVE_RAM_SIZE \ (( CONFIGURE_MEMORY_FOR_POSIX + \ + CONFIGURE_MEMORY_FOR_ITRON + \ CONFIGURE_MEMORY_FOR_TASKS(CONFIGURE_MAXIMUM_TASKS + \ - CONFIGURE_MAXIMUM_POSIX_THREADS + CONFIGURE_MAXIMUM_ADA_TASKS ) + \ + CONFIGURE_MAXIMUM_POSIX_THREADS + CONFIGURE_MAXIMUM_ADA_TASKS + \ + CONFIGURE_MAXIMUM_ITRON_TASKS ) + \ CONFIGURE_MEMORY_FOR_TIMERS(CONFIGURE_MAXIMUM_TIMERS) + \ CONFIGURE_MEMORY_FOR_SEMAPHORES(CONFIGURE_MAXIMUM_SEMAPHORES + \ CONFIGURE_LIBIO_SEMAPHORES) + \ @@ -697,6 +881,21 @@ posix_api_configuration_table Configuration_POSIX_API = { }; #endif +#ifdef RTEMS_ITRON_API +itron_api_configuration_table Configuration_ITRON_API = { + CONFIGURE_MAXIMUM_ITRON_TASKS, + CONFIGURE_MAXIMUM_ITRON_SEMAPHORES, + CONFIGURE_MAXIMUM_ITRON_EVENTFLAGS, + CONFIGURE_MAXIMUM_ITRON_MAILBOXES, + CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS, + CONFIGURE_MAXIMUM_ITRON_PORTS, + CONFIGURE_MAXIMUM_ITRON_MEMORY_POOLS, + CONFIGURE_MAXIMUM_ITRON_FIXED_MEMORY_POOLS, + CONFIGURE_ITRON_INIT_TASK_TABLE_SIZE, + CONFIGURE_ITRON_INIT_TASK_TABLE_NAME +}; +#endif + rtems_configuration_table Configuration = { CONFIGURE_EXECUTIVE_RAM_WORK_AREA, CONFIGURE_EXECUTIVE_RAM_SIZE, @@ -713,9 +912,14 @@ rtems_configuration_table Configuration = { CONFIGURE_MULTIPROCESSING_TABLE, /* pointer to MP config table */ &Configuration_RTEMS_API, /* pointer to RTEMS API config */ #ifdef RTEMS_POSIX_API - &Configuration_POSIX_API /* pointer to POSIX API config */ + &Configuration_POSIX_API, /* pointer to POSIX API config */ +#else + NULL, /* pointer to POSIX API config */ +#endif +#ifdef RTEMS_ITRON_API + &Configuration_ITRON_API /* pointer to ITRON API config */ #else - NULL /* pointer to POSIX API config */ + NULL /* pointer to ITRON API config */ #endif }; #endif diff --git a/c/src/exec/sapi/include/rtems/config.h b/c/src/exec/sapi/include/rtems/config.h index 7439a6e3fe..636813edc5 100644 --- a/c/src/exec/sapi/include/rtems/config.h +++ b/c/src/exec/sapi/include/rtems/config.h @@ -25,8 +25,8 @@ extern "C" { * Unlimited object support. Changes the configuration table entry for POSIX * or RTEMS APIs to bounded only by the memory of the work-space. * - * Use the macro to define the resource unlimited before placing in the configuration - * table. + * Use the macro to define the resource unlimited before placing in + * the configuration table. */ #include @@ -37,16 +37,22 @@ extern "C" { /* * This is kind of kludgy but it allows targets to totally ignore the - * POSIX API safely. + * optional APIs like POSIX and ITRON safely. */ #ifdef RTEMS_POSIX_API #include #else - typedef void *posix_api_configuration_table; #endif +#ifdef RTEMS_ITRON_API +#include +#include +#else +typedef void *itron_api_configuration_table; +#endif + #include /* XXX should cover these @@ -106,6 +112,7 @@ typedef struct { rtems_multiprocessing_table *User_multiprocessing_table; rtems_api_configuration_table *RTEMS_api_configuration; posix_api_configuration_table *POSIX_api_configuration; + itron_api_configuration_table *ITRON_api_configuration; } rtems_configuration_table; /* @@ -165,6 +172,9 @@ SAPI_EXTERN rtems_multiprocessing_table *_Configuration_MP_table; #define rtems_configuration_get_posix_api_configuration() \ (_Configuration_Table->POSIX_api_configuration) +#define rtems_configuration_get_itron_api_configuration() \ + (_Configuration_Table->ITRON_api_configuration) + #ifdef __cplusplus } #endif diff --git a/c/src/exec/sapi/src/Makefile.in b/c/src/exec/sapi/src/Makefile.in index 4223fa423b..102c7cd24a 100644 --- a/c/src/exec/sapi/src/Makefile.in +++ b/c/src/exec/sapi/src/Makefile.in @@ -13,7 +13,8 @@ PROJECT_ROOT = @PROJECT_ROOT@ VPATH = @srcdir@ -C_PIECES = debug entrytable extension fatal exinit io posixapi rtemsapi +C_PIECES = debug entrytable extension fatal exinit io \ + itronapi posixapi rtemsapi C_FILES = $(C_PIECES:%=%.c) C_O_FILES = $(C_PIECES:%=${ARCH}/%.o) diff --git a/c/src/exec/sapi/src/exinit.c b/c/src/exec/sapi/src/exinit.c index 43da0a9363..511a0086f5 100644 --- a/c/src/exec/sapi/src/exinit.c +++ b/c/src/exec/sapi/src/exinit.c @@ -52,6 +52,10 @@ #ifdef RTEMS_POSIX_API #include #endif +#ifdef RTEMS_ITRON_API +#include +#endif + /*PAGE * @@ -211,6 +215,10 @@ rtems_interrupt_level rtems_initialize_executive_early( _POSIX_API_Initialize( configuration_table ); #endif +#ifdef RTEMS_ITRON_API + _ITRON_API_Initialize( configuration_table ); +#endif + _System_state_Set( SYSTEM_STATE_BEFORE_MULTITASKING ); if ( cpu_table->pretasking_hook ) diff --git a/c/src/exec/sapi/src/itronapi.c b/c/src/exec/sapi/src/itronapi.c new file mode 100644 index 0000000000..0309967ecf --- /dev/null +++ b/c/src/exec/sapi/src/itronapi.c @@ -0,0 +1,117 @@ +/* + * ITRON API Initialization Support + * + * NOTE: + * + * COPYRIGHT (c) 1989-1998. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +/* + * ITRON_API_INIT is defined so all of the ITRON API + * data will be included in this object file. + */ + +#define ITRON_API_INIT + +#include /* include this before checking RTEMS_ITRON_API */ +#ifdef RTEMS_ITRON_API + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +/*PAGE + * + * _ITRON_API_Initialize + * + * XXX + */ + +itron_api_configuration_table _ITRON_Default_configuration = { + 0, /* maximum_tasks */ + 0, /* maximum_semaphores */ + 0, /* maximum_eventflags */ + 0, /* maximum_mailboxes */ + 0, /* maximum_message_buffers */ + 0, /* maximum_ports */ + 0, /* maximum_memory_pools */ + 0, /* maximum_fixed_memory_pools */ + 0, /* number_of_initialization_tasks */ + NULL /* User_initialization_tasks_table */ +}; + + +void _ITRON_API_Initialize( + rtems_configuration_table *configuration_table +) +{ + itron_api_configuration_table *api_configuration; + + /* XXX need to assert here based on size assumptions */ + + assert( sizeof(ID) == sizeof(Objects_Id) ); + + api_configuration = configuration_table->ITRON_api_configuration; + if ( !api_configuration ) + api_configuration = &_ITRON_Default_configuration; + + _ITRON_Task_Manager_initialization( + api_configuration->maximum_tasks, + api_configuration->number_of_initialization_tasks, + api_configuration->User_initialization_tasks_table + ); + + _ITRON_Semaphore_Manager_initialization( + api_configuration->maximum_semaphores + ); + + _ITRON_Eventflags_Manager_initialization( + api_configuration->maximum_eventflags + ); + + _ITRON_Fixed_memory_pool_Manager_initialization( + api_configuration->maximum_fixed_memory_pools + ); + + _ITRON_Mailbox_Manager_initialization( + api_configuration->maximum_mailboxes + ); + + _ITRON_Message_buffer_Manager_initialization( + api_configuration->maximum_message_buffers + ); + + _ITRON_Port_Manager_initialization( + api_configuration->maximum_ports + ); + + _ITRON_Variable_memory_pool_Manager_initialization( + api_configuration->maximum_memory_pools + ); + + +} + +#endif +/* end of file */ diff --git a/c/src/exec/score/cpu/configure.in b/c/src/exec/score/cpu/configure.in index 5602c780eb..dc468089ae 100644 --- a/c/src/exec/score/cpu/configure.in +++ b/c/src/exec/score/cpu/configure.in @@ -13,6 +13,7 @@ RTEMS_CANONICAL_TARGET_CPU AM_MAINTAINER_MODE RTEMS_ENABLE_MULTIPROCESSING RTEMS_ENABLE_POSIX +RTEMS_ENABLE_ITRON RTEMS_ENABLE_INLINES RTEMS_ENABLE_LIBCDIR @@ -35,6 +36,7 @@ RTEMS_CHECK_NEWLIB RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP) RTEMS_CHECK_MULTIPROCESSING(RTEMS_BSP) RTEMS_CHECK_POSIX_API(RTEMS_BSP) +RTEMS_CHECK_ITRON_API(RTEMS_BSP) RTEMS_CHECK_SYSV_UNIX @@ -42,6 +44,7 @@ RTEMS_CHECK_SYSV_UNIX RTEMS_CHECK_MAKEFILE($RTEMS_CPU) AM_CONDITIONAL(HAS_POSIX,test "$HAS_POSIX_API" = "yes") +AM_CONDITIONAL(HAS_ITRON,test "$HAS_ITRON_API" = "yes") # Try to explicitly list a Makefile here AC_OUTPUT( diff --git a/c/src/exec/score/include/rtems/score/Makefile.in b/c/src/exec/score/include/rtems/score/Makefile.in index d0c6b21300..7dc33b70a7 100644 --- a/c/src/exec/score/include/rtems/score/Makefile.in +++ b/c/src/exec/score/include/rtems/score/Makefile.in @@ -93,6 +93,10 @@ $(TARGOPTS): @if test "$(HAS_POSIX_API)" = "yes"; then \ echo "#define RTEMS_POSIX_API 1" >>$@; \ fi + echo "SHOULD BE HAS_ITRON_API not RTEMS_HAS_ITRON_API XXX " + @if test "$(RTEMS_HAS_ITRON_API)" = "yes"; then \ + echo "#define RTEMS_ITRON_API 1" >>$@; \ + fi @if test "$(RTEMS_USE_NEWLIB)" = "yes"; then \ echo "#define RTEMS_NEWLIB 1" >>$@; \ echo "#define MALLOC_PROVIDED 1" >>$@; \ diff --git a/c/src/exec/score/include/rtems/score/interr.h b/c/src/exec/score/include/rtems/score/interr.h index e999ceff7a..f3fba47f66 100644 --- a/c/src/exec/score/include/rtems/score/interr.h +++ b/c/src/exec/score/include/rtems/score/interr.h @@ -30,7 +30,8 @@ extern "C" { typedef enum { INTERNAL_ERROR_CORE, INTERNAL_ERROR_RTEMS_API, - INTERNAL_ERROR_POSIX_API + INTERNAL_ERROR_POSIX_API, + INTERNAL_ERROR_ITRON_API } Internal_errors_Source; /* diff --git a/c/src/exec/score/include/rtems/score/object.h b/c/src/exec/score/include/rtems/score/object.h index 7c72719679..9f4a6a929d 100644 --- a/c/src/exec/score/include/rtems/score/object.h +++ b/c/src/exec/score/include/rtems/score/object.h @@ -86,30 +86,38 @@ typedef unsigned32 Objects_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_NO_CLASS = 0, + OBJECTS_INTERNAL_THREADS = 1, + OBJECTS_RTEMS_TASKS = 2, + OBJECTS_POSIX_THREADS = 3, + OBJECTS_ITRON_TASKS = 4, + OBJECTS_RTEMS_TIMERS = 5, + OBJECTS_RTEMS_SEMAPHORES = 6, + OBJECTS_RTEMS_MESSAGE_QUEUES = 7, + OBJECTS_RTEMS_PARTITIONS = 8, + OBJECTS_RTEMS_REGIONS = 9, + OBJECTS_RTEMS_PORTS = 10, + OBJECTS_RTEMS_PERIODS = 11, + OBJECTS_RTEMS_EXTENSIONS = 12, + OBJECTS_POSIX_KEYS = 13, + OBJECTS_POSIX_INTERRUPTS = 14, + OBJECTS_POSIX_MESSAGE_QUEUES = 15, + OBJECTS_POSIX_MUTEXES = 16, + OBJECTS_POSIX_SEMAPHORES = 17, + OBJECTS_POSIX_CONDITION_VARIABLES = 18, + OBJECTS_ITRON_EVENTFLAGS = 19, + OBJECTS_ITRON_MAILBOXES = 20, + OBJECTS_ITRON_MESSAGE_BUFFERS = 21, + OBJECTS_ITRON_PORTS = 22, + OBJECTS_ITRON_SEMAPHORES = 23, + OBJECTS_ITRON_VARIABLE_MEMORY_POOLS = 24, + OBJECTS_ITRON_FIXED_MEMORY_POOLS = 25 } Objects_Classes; #define OBJECTS_CLASSES_FIRST OBJECTS_NO_CLASS -#define OBJECTS_CLASSES_LAST OBJECTS_POSIX_CONDITION_VARIABLES +#define OBJECTS_CLASSES_LAST OBJECTS_ITRON_FIXED_MEMORY_POOLS #define OBJECTS_CLASSES_FIRST_THREAD_CLASS OBJECTS_INTERNAL_THREADS -#define OBJECTS_CLASSES_LAST_THREAD_CLASS OBJECTS_POSIX_THREADS +#define OBJECTS_CLASSES_LAST_THREAD_CLASS OBJECTS_ITRON_TASKS /* * This enumerated type lists the locations which may be returned @@ -284,6 +292,22 @@ Objects_Control *_Objects_Allocate( Objects_Information *information ); +/* + * _Objects_Allocate_by_index + * + * DESCRIPTION: + * + * This function allocates the object control block + * specified by the index from the inactive chain of + * free object control blocks. + */ + +Objects_Control *_Objects_Allocate_by_index( + Objects_Information *information, + unsigned32 index, + unsigned32 sizeof_control +); + /*PAGE * * _Objects_Free diff --git a/c/src/exec/score/include/rtems/score/thread.h b/c/src/exec/score/include/rtems/score/thread.h index 1ca0005490..26452bffbe 100644 --- a/c/src/exec/score/include/rtems/score/thread.h +++ b/c/src/exec/score/include/rtems/score/thread.h @@ -166,11 +166,12 @@ typedef struct { typedef enum { THREAD_API_RTEMS, - THREAD_API_POSIX + THREAD_API_POSIX, + THREAD_API_ITRON } Thread_APIs; #define THREAD_API_FIRST THREAD_API_RTEMS -#define THREAD_API_LAST THREAD_API_POSIX +#define THREAD_API_LAST THREAD_API_ITRON struct Thread_Control_struct { Objects_Control Object; diff --git a/c/src/exec/score/include/rtems/system.h b/c/src/exec/score/include/rtems/system.h index 4d7f550141..423952aa56 100644 --- a/c/src/exec/score/include/rtems/system.h +++ b/c/src/exec/score/include/rtems/system.h @@ -69,6 +69,14 @@ extern "C" { #define POSIX_EXTERN extern #endif +#ifdef ITRON_API_INIT +#undef ITRON_EXTERN +#define ITRON_EXTERN +#else +#undef ITRON_EXTERN +#define ITRON_EXTERN extern +#endif + /* * The following (in conjunction with compiler arguments) are used * to choose between the use of static inline functions and macro diff --git a/c/src/exec/wrapup/Makefile.am b/c/src/exec/wrapup/Makefile.am index 7ffcb8282c..67e58c56c3 100644 --- a/c/src/exec/wrapup/Makefile.am +++ b/c/src/exec/wrapup/Makefile.am @@ -8,7 +8,11 @@ if HAS_POSIX POSIX_DIRS = posix endif -SUBDIRS = rtems $(POSIX_DIRS) +if HAS_ITRON +ITRON_DIRS = itron +endif + +SUBDIRS = rtems $(POSIX_DIRS) $(ITRON_DIRS) include $(top_srcdir)/../../../automake/subdirs.am include $(top_srcdir)/../../../automake/local.am diff --git a/c/src/exec/wrapup/itron/Makefile.in b/c/src/exec/wrapup/itron/Makefile.in new file mode 100644 index 0000000000..eecd38fc21 --- /dev/null +++ b/c/src/exec/wrapup/itron/Makefile.in @@ -0,0 +1,58 @@ +# +# $Id$ +# + +@SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +top_builddir = ../.. +subdir = wrapup/itron + +RTEMS_ROOT = @RTEMS_ROOT@ +PROJECT_ROOT = @PROJECT_ROOT@ + +VPATH = @srcdir@ + +ITRON_OBJS = $(wildcard ../../itron/src/$(ARCH)/*.o) + +OBJS = $(ITRON_OBJS) +# HACK: AM_CONDITIONAL +LIB = @HAS_ITRON_TRUE@$(ARCH)/libitron.a + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(RTEMS_ROOT)/make/lib.cfg + +INSTALL_CHANGE = @INSTALL_CHANGE@ + +# +# (OPTIONAL) Add local stuff here using += +# + +DEFINES += +CPPFLAGS += +CFLAGS += + +LD_PATHS += +LD_LIBS += +LDFLAGS += + +# +# Add your list of files to delete here. The config files +# already know how to delete some stuff, so you may want +# to just run 'make clean' first to see what gets missed. +# 'make clobber' already includes 'make clean' +# + +CLEAN_ADDITIONS += +CLOBBER_ADDITIONS += + +$(LIB): ${OBJS} + $(make-library) + +# HACK: AM_CONDITIONAL +all: @HAS_ITRON_TRUE@${ARCH} $(SRCS) $(LIB) +@HAS_ITRON_TRUE@ @$(INSTALL_VARIANT) -m 644 $(LIB) $(PROJECT_RELEASE)/lib + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status diff --git a/c/src/exec/wrapup/posix/Makefile.in b/c/src/exec/wrapup/posix/Makefile.in index 86b227b2e0..4ea34f75fb 100644 --- a/c/src/exec/wrapup/posix/Makefile.in +++ b/c/src/exec/wrapup/posix/Makefile.in @@ -13,12 +13,6 @@ PROJECT_ROOT = @PROJECT_ROOT@ VPATH = @srcdir@ -# -# This is really temporary until posix is more an integral part of the tree. -# -#CPU_OBJS=$(wildcard ../../score/cpu/$(RTEMS_CPU)/$(ARCH)/*.rel) -#CORE_OBJS=$(wildcard ../../score/src/$(ARCH)/*.o) -#SAPI_OBJS=$(wildcard ../../sapi/src/$(ARCH)/*.o) POSIX_OBJS = $(wildcard ../../posix/src/$(ARCH)/*.o) OBJS = $(CPU_OBJS) $(CORE_OBJS) $(POSIX_OBJS) $(SAPI_OBJS) diff --git a/c/src/tests/configure.in b/c/src/tests/configure.in index 1b6e98e2fe..2c0212f7a2 100644 --- a/c/src/tests/configure.in +++ b/c/src/tests/configure.in @@ -14,6 +14,7 @@ AM_MAINTAINER_MODE RTEMS_ENABLE_MULTIPROCESSING RTEMS_ENABLE_POSIX +RTEMS_ENABLE_ITRON RTEMS_ENABLE_NETWORKING RTEMS_ENABLE_INLINES RTEMS_ENABLE_CXX @@ -41,8 +42,10 @@ RTEMS_CANONICALIZE_TOOLS RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP) RTEMS_CHECK_MULTIPROCESSING(RTEMS_BSP) RTEMS_CHECK_POSIX_API(RTEMS_BSP) +RTEMS_CHECK_ITRON_API(RTEMS_BSP) if test "$tests_enabled" = "yes"; then + # do functionality tests first, then performance tests cfg_subdirs="libtests sptests" if test "$HAS_MP" = "yes"; then cfg_subdirs="$cfg_subdirs mptests" @@ -50,7 +53,14 @@ if test "$tests_enabled" = "yes"; then if test "$HAS_POSIX_API" = "yes"; then cfg_subdirs="$cfg_subdirs psxtests" fi + if test "$HAS_ITRON_API" = "yes"; then + cfg_subdirs="$cfg_subdirs itrontests tmitrontests" + fi + # Now do performance tests cfg_subdirs="$cfg_subdirs tmtests" + if test "$HAS_ITRON_API" = "yes"; then + cfg_subdirs="$cfg_subdirs tmitrontests" + fi fi AC_SUBST(BARE_CPU_CFLAGS) diff --git a/c/src/tests/itrontests/Makefile.am b/c/src/tests/itrontests/Makefile.am new file mode 100644 index 0000000000..ff9e16ae5a --- /dev/null +++ b/c/src/tests/itrontests/Makefile.am @@ -0,0 +1,21 @@ +## +## $Id$ +## + +AUTOMAKE_OPTIONS = foreign 1.4 +ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal + +project_bspdir = $(PROJECT_ROOT)/@RTEMS_BSP@ + +PREINSTALLDIRS = $(project_bspdir)/tests/screens/psxtests +$(PREINSTALLDIRS): + @$(mkinstalldirs) $@ + +all-local: $(PREINSTALLDIRS) + +ITRON_DIRS = itronhello itrontask01 itronmbf01 itronsem01 itrontime01 + +SUBDIRS = $(ITRON_DIRS) + +include $(top_srcdir)/../../../../automake/subdirs.am +include $(top_srcdir)/../../../../automake/local.am diff --git a/c/src/tests/itrontests/README b/c/src/tests/itrontests/README new file mode 100644 index 0000000000..65c5d4165d --- /dev/null +++ b/c/src/tests/itrontests/README @@ -0,0 +1,6 @@ +# +# $Id$ +# + +This directory contains the functionality tests for the ITRON 3.0 API +implementation. diff --git a/c/src/tests/itrontests/configure.in b/c/src/tests/itrontests/configure.in new file mode 100644 index 0000000000..34301af2a1 --- /dev/null +++ b/c/src/tests/itrontests/configure.in @@ -0,0 +1,48 @@ +dnl Process this file with autoconf to produce a configure script. +dnl +dnl $Id$ + +AC_PREREQ(2.13) +AC_INIT(itronhello) +RTEMS_TOP(../../../..) +AC_CONFIG_AUX_DIR(../../../..) + +RTEMS_CANONICAL_TARGET_CPU + +AM_INIT_AUTOMAKE(rtems-c-src-tests-itrontests,$RTEMS_VERSION,no) +AM_MAINTAINER_MODE + +RTEMS_ENABLE_INLINES +RTEMS_ENABLE_GCC28 +RTEMS_ENABLE_LIBCDIR +RTEMS_ENABLE_BARE + +RTEMS_ENV_RTEMSBSP +RTEMS_CHECK_CPU +RTEMS_CANONICAL_HOST + +RTEMS_PROJECT_ROOT + +RTEMS_PROG_CC_FOR_TARGET + +RTEMS_CANONICALIZE_TOOLS + +RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP) + +AC_SUBST(RTEMS_USE_GCC272) +AC_SUBST(BARE_CPU_CFLAGS) +AC_SUBST(BARE_CPU_MODEL) +AC_SUBST(CC_CFLAGS_DEFAULT) +AC_SUBST(CC_CFLAGS_DEBUG_V) +AC_SUBST(CC_CFLAGS_PROFILE_V) +AC_SUBST(CC_LDFLAGS_PROFILE_V) + +# Try to explicitly list a Makefile here +AC_OUTPUT( +Makefile +itronhello/Makefile +itronmbf01/Makefile +itronsem01/Makefile +itrontask01/Makefile +itrontime01/Makefile +) diff --git a/c/src/tests/itrontests/itronhello/init.c b/c/src/tests/itrontests/itronhello/init.c new file mode 100644 index 0000000000..f2c079048c --- /dev/null +++ b/c/src/tests/itrontests/itronhello/init.c @@ -0,0 +1,30 @@ +/* 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 + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#define TEST_INIT +#include "system.h" +#include + +void ITRON_Init( void ) +{ + printf( "\n\n*** ITRON HELLO WORLD TEST ***\n" ); + printf( "Hello World\n" ); + printf( "*** END OF ITRON HELLO WORLD TEST ***\n" ); + exit( 0 ); +} diff --git a/c/src/tests/itrontests/itronhello/system.h b/c/src/tests/itrontests/itronhello/system.h new file mode 100644 index 0000000000..d7a30d195b --- /dev/null +++ b/c/src/tests/itrontests/itronhello/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-1998. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +/* functions */ + +void ITRON_Init( void ); + +/* configuration information */ + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER + +#define CONFIGURE_ITRON_INIT_TASK_TABLE + +#include + +/* global variables */ + +TEST_EXTERN rtems_id Global_variable; /* example global variable */ + +/* end of include file */ diff --git a/c/src/tests/itrontests/itronmbf01/init.c b/c/src/tests/itrontests/itronmbf01/init.c new file mode 100644 index 0000000000..39788c49f8 --- /dev/null +++ b/c/src/tests/itrontests/itronmbf01/init.c @@ -0,0 +1,362 @@ +/* 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 + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#define TEST_INIT +#include "system.h" +#include +#include + +/* + * The following is hopefully temporary. + */ + +#include + +#define put_time(_s) \ +do { \ + time_t a_time_t; \ + a_time_t = time( 0 ); \ + printf( "%s%s", _s, ctime( &a_time_t ) ); \ +} while(0) + + + +void TestCre(); +void TestDel(); +void TestPsnd(); +void TestRef(); +void TestTrcv(); +void TestRcv(); +void TestPrcv(); + +void ITRON_Init( void ) +{ + printf( "\n\n*** ITRONMBF01 -- ITRON MESSAGE BUFFER TEST ***\n" ); + + TestCre(); + TestDel(); + TestPsnd(); + TestRef(); + TestRcv(); + TestRef(); + TestPrcv(); + TestTrcv(); + + printf("\n\n*** ITRONMBF01 --- ITRON MESSAGE BUFFER TEST ***\n"); + exit(0); +} + +void TestCre() +{ + ER status; + T_CMBF pk_cmbf; + + /* + * Exercise cre_mbf - this code seems to exercise every path. + */ + + puts( "Init - cre_mbf - NULL pk_cmbf returns E_PAR" ); + status = cre_mbf( 1, NULL ); + assert( status == E_PAR ); + + puts( "Init - cre_mbf - negative values for bufsz returns E_PAR" ); + pk_cmbf.bufsz = -1; + pk_cmbf.maxmsz = 100; + status = cre_mbf( 1, &pk_cmbf ); + assert( status == E_PAR ); + + puts( "Init - cre_mbf - negative values for maxmsz returns E_PAR" ); + pk_cmbf.bufsz = 100; + pk_cmbf.maxmsz = -1; + status = cre_mbf( 1, &pk_cmbf ); + assert( status == E_PAR ); + + puts( "Init - cre_mbf - bufsz < maxmsz returns E_PAR" ); + pk_cmbf.bufsz = 100; + pk_cmbf.maxmsz = 101; + status = cre_mbf( 1, &pk_cmbf ); + assert( status == E_PAR ); + + /* + * Now run through all the bad ID errors + */ + + pk_cmbf.bufsz = 200; + pk_cmbf.maxmsz = 30; + puts( "Init - cre_mbf - bad id (less than -4) - E_OACV" ); + status = cre_mbf( -5, &pk_cmbf ); + assert( status == E_OACV ); + + puts( "Init - cre_mbf - bad id (between 0 and -4) - E_ID" ); + status = cre_mbf( -4, &pk_cmbf ); + assert( status == E_ID ); + + puts( "Init - cre_mbf - bad id (0) - E_ID" ); + status = cre_mbf( 0, &pk_cmbf ); + assert( status == E_ID ); + + puts( "Init - cre_mbf - bad id (too great) - E_ID" ); + status = cre_mbf( CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS + 1, &pk_cmbf ); + assert( status == E_ID ); + + puts( "Init - cre_mbf - create mbf 1 TA_TFIFO - E_OK" ); + pk_cmbf.bufsz = 600; + pk_cmbf.maxmsz = 200; + pk_cmbf.mbfatr = TA_TFIFO; + status = cre_mbf( 1, &pk_cmbf ); + assert( status == E_OK ); + + puts( "Init - cre_mbf - create mbf 1 again - E_OBJ" ); + status = cre_mbf( 1, &pk_cmbf ); + assert( status == E_OBJ ); + + puts( "Init - cre_mbf - create mbf 2 TA_TPRI - E_OK" ); + pk_cmbf.bufsz = 600; + pk_cmbf.maxmsz = 200; + pk_cmbf.mbfatr = TA_TPRI; + status = cre_mbf( 2, &pk_cmbf ); + assert( status == E_OK ); +} + +void TestDel() +{ + ER status; + + /* + * Generate all the bad id errors for del_mbf + */ + + puts( "Init - del_mbf - bad id (less than -4) - E_OACV" ); + status = del_mbf( -5 ); + assert( status == E_OACV ); + + puts( "Init - del_mbf - bad id (between 0 and -4) - E_ID" ); + status = del_mbf( -4 ); + assert( status == E_ID ); + + puts( "Init - del_mbf - bad id (0) - E_ID" ); + status = del_mbf( 0 ); + assert( status == E_ID ); + + puts( "Init - del_mbf - bad id (too great) - E_ID" ); + status = del_mbf( CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS + 1 ); + assert( status == E_ID ); + + + puts("Init - del_mbf - E_OK" ); + status = del_mbf(2); + assert(status == E_OK); +} + +void TestPsnd() +{ + ER status; + char msg[100] = "This is test message 1"; + + /* + * Generate all the bad id errors for psnd_mbf + */ + + puts( "Init - psnd_mbf - bad id (less than -4) - E_OACV" ); + status = psnd_mbf(-5, msg, sizeof(msg)); + assert( status == E_OACV ); + + puts( "Init - psnd_mbf - bad id (between 0 and -4) - E_ID" ); + status = psnd_mbf(-4, msg, sizeof(msg)); + assert( status == E_ID ); + + puts( "Init - psnd_mbf - bad id (0) - E_ID" ); + status = psnd_mbf(0, msg, sizeof(msg)); + assert( status == E_ID ); + + puts( "Init - psnd_mbf - bad id (too great) - E_ID" ); + status = psnd_mbf(CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS + 1, msg, + sizeof(msg)); + assert( status == E_ID ); + + puts( "Init - psnd_mbf - msg == 0, E_PAR" ); + status = psnd_mbf(1, 0, sizeof(msg)); + assert( status == E_PAR ); + + puts( "Init - psnd_mbf - msgsz too big - E_PAR" ); + status = psnd_mbf(1, msg, 300); + assert( status == E_PAR ); + + puts( "Init - psnd_mbf - msgsz <0 - E_PAR" ); + status = psnd_mbf(1, msg, -10); + assert( status == E_PAR ); + + puts( "Init - psnd_mbf - E_OK" ); + status = psnd_mbf(1, msg, sizeof(msg)); + assert( status == E_OK ); +} + +void TestRef() +{ + ER status; + T_RMBF pk_rmbf; + + puts( "Init - ref_mbf - bad id (less than -4) - E_OACV" ); + status = ref_mbf(&pk_rmbf, -5); + assert( status == E_OACV ); + + puts( "Init - ref_mbf - bad id (between 0 and -4) - E_ID" ); + status = ref_mbf(&pk_rmbf, -4); + assert( status == E_ID ); + + puts( "Init - ref_mbf - bad id (0) - E_ID" ); + status = ref_mbf(&pk_rmbf, 0); + assert( status == E_ID ); + + puts( "Init - ref_mbf - bad id (too great) - E_ID" ); + status = ref_mbf(&pk_rmbf, + CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS + 1); + assert( status == E_ID ); + + puts( "Init - ref_mbf - NULL pk_mbf returns E_PAR" ); + status = ref_mbf( NULL, 1 ); + assert( status == E_PAR ); + + puts( "Init - ref_mbf - mbf 1 - E_OK" ); + status = ref_mbf( &pk_rmbf, 1 ); + assert( status == E_OK ); + + printf( "Init - mbf 1 msgsz = %d\n", pk_rmbf.msgsz ); + printf( "Init - mbf 1 frbufsz = %d\n", pk_rmbf.frbufsz ); + printf( "Init - mbf 1 waiting tasks = %d\n", pk_rmbf.wtsk ); + printf( "Init - mbf 1 sending tasks = %d\n", pk_rmbf.stsk); +} + +void TestRcv() +{ + ER status; + char buffer[200]; + int s; + + puts( "Init - rcv_mbf - bad id (less than -4) - E_OACV" ); + status = rcv_mbf(buffer, &s, -5); + assert( status == E_OACV ); + + puts( "Init - rcv_mbf - bad id (between 0 and -4) - E_ID" ); + status = rcv_mbf(buffer, &s, -4); + assert( status == E_ID ); + + puts( "Init - rcv_mbf - bad id (0) - E_ID" ); + status = rcv_mbf(buffer, &s, 0); + assert( status == E_ID ); + + puts( "Init - rcv_mbf - bad id (too great) - E_ID" ); + status = rcv_mbf(buffer, &s, CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS + 1); + assert( status == E_ID ); + + puts( "Init - rcv_mbf - NULL msg returns E_PAR" ); + status = rcv_mbf(NULL, &s, 1); + assert( status == E_PAR ); + + puts( "Init - rcv_mbf - NULL p_msgsz returns E_PAR" ); + status = rcv_mbf(buffer, 0, 1); + assert( status == E_PAR ); + + puts("Init - rcv_mbf -- OK"); + status = rcv_mbf(buffer, &s, 1); + assert(status == E_OK); + printf("Message:[%s], length:%d\n", buffer, s); +} + + +void TestPrcv() +{ + ER status; + char buffer[200]; + int s; + + puts( "Init - prcv_mbf - bad id (less than -4) - E_OACV" ); + status = prcv_mbf(buffer, &s, -5); + assert( status == E_OACV ); + + puts( "Init - prcv_mbf - bad id (between 0 and -4) - E_ID" ); + status = prcv_mbf(buffer, &s, -4); + assert( status == E_ID ); + + puts( "Init - prcv_mbf - bad id (0) - E_ID" ); + status = prcv_mbf(buffer, &s, 0); + assert( status == E_ID ); + + puts( "Init - prcv_mbf - bad id (too great) - E_ID" ); + status = prcv_mbf(buffer, &s, CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS + 1); + assert( status == E_ID ); + + puts( "Init - prcv_mbf - NULL msg returns E_PAR" ); + status = prcv_mbf(NULL, &s, 1); + assert( status == E_PAR ); + + puts( "Init - prcv_mbf - NULL p_msgsz returns E_PAR" ); + status = prcv_mbf(buffer, 0, 1); + assert( status == E_PAR ); + + puts("Init - prcv_mbf -- E_TMOUT"); + status = prcv_mbf(buffer, &s, 1); + assert(status == E_TMOUT); +} + + +void TestTrcv() +{ + ER status; + char buffer[200]; + int s; + + puts( "Init - trcv_mbf - bad id (less than -4) - E_OACV" ); + status = trcv_mbf(buffer, &s, -5, 5000); + assert( status == E_OACV ); + + puts( "Init - trcv_mbf - bad id (between 0 and -4) - E_ID" ); + status = trcv_mbf(buffer, &s, -4, 5000); + assert( status == E_ID ); + + puts( "Init - trcv_mbf - bad id (0) - E_ID" ); + status = trcv_mbf(buffer, &s, 0, 5000); + assert( status == E_ID ); + + puts( "Init - trcv_mbf - bad id (too great) - E_ID" ); + status = trcv_mbf(buffer, &s, + CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS + 1, + 5000); + assert( status == E_ID ); + + puts( "Init - trcv_mbf - NULL msg returns E_PAR" ); + status = trcv_mbf(NULL, &s, 1, 5000); + assert( status == E_PAR ); + + puts( "Init - trcv_mbf - NULL p_msgsz returns E_PAR" ); + status = trcv_mbf(buffer, 0, 1, 5000); + assert( status == E_PAR ); + + puts( "Init - trcv_mbf - tmout <-2 returns E_PAR" ); + status = trcv_mbf(buffer, &s, 1, -2); + assert( status == E_PAR ); + + puts("\nInit - trcv_mbf -- E_TMOUT"); + put_time( "Init - starting to block at "); + status = trcv_mbf(buffer, &s, 1, 1000); + assert(status == E_TMOUT); + put_time( "Init - time out at "); +} + + diff --git a/c/src/tests/itrontests/itronmbf01/system.h b/c/src/tests/itrontests/itronmbf01/system.h new file mode 100644 index 0000000000..b433415b2b --- /dev/null +++ b/c/src/tests/itrontests/itronmbf01/system.h @@ -0,0 +1,37 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989-1998. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +/* functions */ + +void ITRON_Init( void ); + +/* configuration information */ + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_ITRON_INIT_TASK_TABLE +#define CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS 10 + +#include + +/* global variables */ + +TEST_EXTERN rtems_id Global_variable; /* example global variable */ + +/* end of include file */ diff --git a/c/src/tests/itrontests/itronsem01/init.c b/c/src/tests/itrontests/itronsem01/init.c new file mode 100644 index 0000000000..4748de7f45 --- /dev/null +++ b/c/src/tests/itrontests/itronsem01/init.c @@ -0,0 +1,328 @@ +/* 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 + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#define TEST_INIT +#include "system.h" +#include + +/* + * The following is hopefully temporary. + */ + +#include + +#define put_time(_s) \ + do { \ + time_t a_time_t; \ + a_time_t = time( 0 ); \ + printf( "%s%s", _s, ctime( &a_time_t ) ); \ + } while(0) + +void ITRON_Init( void ) +{ + ER status; + T_CSEM pk_csem; + T_RSEM pk_rsem; + + printf( "\n\n*** ITRONSEM01 -- ITRON SEMAPHORE TEST ***\n" ); + + /* + * Exercise cre_sem - this code seems to exercise every path. + */ + + puts( "Init - cre_sem - NULL pk_sem returns E_PAR" ); + status = cre_sem( 1, NULL ); + assert( status == E_PAR ); + + puts( "Init - cre_sem - isemcnt > maxsem returns E_PAR" ); + pk_csem.isemcnt = 3; + pk_csem.maxsem = 2; + status = cre_sem( 1, &pk_csem ); + assert( status == E_PAR ); + + puts( "Init - cre_sem - maxsem of 0 returns E_PAR" ); + pk_csem.isemcnt = 0; + pk_csem.maxsem = 0; + status = cre_sem( 1, &pk_csem ); + assert( status == E_PAR ); + + /* + * Now run through all the bad ID errors + */ + + pk_csem.isemcnt = 2; + pk_csem.maxsem = 3; + puts( "Init - cre_sem - bad id (less than -4) - E_OACV" ); + status = cre_sem( -5, &pk_csem ); + assert( status == E_OACV ); + + puts( "Init - cre_sem - bad id (between 0 and -4) - E_ID" ); + status = cre_sem( -4, &pk_csem ); + assert( status == E_ID ); + + puts( "Init - cre_sem - bad id (0) - E_ID" ); + status = cre_sem( 0, &pk_csem ); + assert( status == E_ID ); + + puts( "Init - cre_sem - bad id (too great) - E_ID" ); + status = cre_sem( CONFIGURE_MAXIMUM_ITRON_SEMAPHORES + 1, &pk_csem ); + assert( status == E_ID ); + + puts( "Init - cre_sem - create semaphore 1 TA_TFIFO - E_OK" ); + pk_csem.isemcnt = 2; + pk_csem.maxsem = 3; + pk_csem.sematr = TA_TFIFO; + status = cre_sem( 1, &pk_csem ); + assert( status == E_OK ); + + puts( "Init - cre_sem - create semaphore 1 again - E_OBJ" ); + status = cre_sem( 1, &pk_csem ); + assert( status == E_OBJ ); + + puts( "Init - cre_sem - create semaphore 2 TA_TPRI - E_OK" ); + pk_csem.isemcnt = 2; + pk_csem.maxsem = 3; + pk_csem.sematr = TA_TPRI; + status = cre_sem( 2, &pk_csem ); + assert( status == E_OK ); + + /* + * Generate all the bad id errors for del_sem + */ + + puts( "Init - del_sem - bad id (less than -4) - E_OACV" ); + status = del_sem( -5 ); + assert( status == E_OACV ); + + puts( "Init - del_sem - bad id (between 0 and -4) - E_ID" ); + status = del_sem( -4 ); + assert( status == E_ID ); + + puts( "Init - del_sem - bad id (0) - E_ID" ); + status = del_sem( 0 ); + assert( status == E_ID ); + + puts( "Init - del_sem - bad id (too great) - E_ID" ); + status = del_sem( CONFIGURE_MAXIMUM_ITRON_SEMAPHORES + 1 ); + assert( status == E_ID ); + + /* + * Generate all the bad id errors for sig_sem + */ + + puts( "Init - sig_sem - bad id (less than -4) - E_OACV" ); + status = sig_sem( -5 ); + assert( status == E_OACV ); + + puts( "Init - sig_sem - bad id (between 0 and -4) - E_ID" ); + status = sig_sem( -4 ); + assert( status == E_ID ); + + puts( "Init - sig_sem - bad id (0) - E_ID" ); + status = sig_sem( 0 ); + assert( status == E_ID ); + + puts( "Init - sig_sem - bad id (too great) - E_ID" ); + status = wai_sem( CONFIGURE_MAXIMUM_ITRON_SEMAPHORES + 1 ); + assert( status == E_ID ); + + /* + * Generate all the bad id errors for preq_sem + */ + + puts( "Init - preq_sem - bad id (less than -4) - E_OACV" ); + status = preq_sem( -5 ); + assert( status == E_OACV ); + + puts( "Init - preq_sem - bad id (between 0 and -4) - E_ID" ); + status = preq_sem( -4 ); + assert( status == E_ID ); + + puts( "Init - preq_sem - bad id (0) - E_ID" ); + status = preq_sem( 0 ); + assert( status == E_ID ); + + puts( "Init - preq_sem - bad id (too great) - E_ID" ); + status = preq_sem( CONFIGURE_MAXIMUM_ITRON_SEMAPHORES + 1 ); + assert( status == E_ID ); + + /* + * Generate all the bad id errors for wai_sem + */ + + puts( "Init - wai_sem - bad id (less than -4) - E_OACV" ); + status = wai_sem( -5 ); + assert( status == E_OACV ); + + puts( "Init - wai_sem - bad id (between 0 and -4) - E_ID" ); + status = wai_sem( -4 ); + assert( status == E_ID ); + + puts( "Init - wai_sem - bad id (0) - E_ID" ); + status = wai_sem( 0 ); + assert( status == E_ID ); + + puts( "Init - wai_sem - bad id (too great) - E_ID" ); + status = wai_sem( CONFIGURE_MAXIMUM_ITRON_SEMAPHORES + 1 ); + assert( status == E_ID ); + + /* + * Generate all the bad id errors for twai_sem + */ + + puts( "Init - twai_sem - bad id (less than -4) - E_OACV" ); + status = twai_sem( -5, 1000 ); + assert( status == E_OACV ); + + puts( "Init - twai_sem - bad id (between 0 and -4) - E_ID" ); + status = twai_sem( -4, 1000 ); + assert( status == E_ID ); + + puts( "Init - twai_sem - bad id (0) - E_ID" ); + status = twai_sem( 0, 1000 ); + assert( status == E_ID ); + + puts( "Init - twai_sem - bad id (too great) - E_ID" ); + status = twai_sem( CONFIGURE_MAXIMUM_ITRON_SEMAPHORES + 1, 1000 ); + assert( status == E_ID ); + + /* + * Generate all the bad id errors for ref_sem + */ + + puts( "Init - ref_sem - bad id (less than -4) - E_OACV" ); + status = ref_sem( -5, &pk_rsem ); + assert( status == E_OACV ); + + puts( "Init - ref_sem - bad id (between 0 and -4) - E_ID" ); + status = ref_sem( -4, &pk_rsem ); + assert( status == E_ID ); + + puts( "Init - ref_sem - bad id (0) - E_ID" ); + status = ref_sem( 0, &pk_rsem ); + assert( status == E_ID ); + + puts( "Init - ref_sem - bad id (too great) - E_ID" ); + status = ref_sem( CONFIGURE_MAXIMUM_ITRON_SEMAPHORES + 1, &pk_rsem ); + assert( status == E_ID ); + + /* + * Exercise preq_sem (and sig_sem a little) + */ + + + puts( "Init - preq_sem - semaphore 1 available (count --> 1) - E_OK" ); + status = preq_sem( 1 ); + assert( status == E_OK ); + + puts( "Init - preq_sem - semaphore 1 available (count --> 0) - E_OK" ); + status = preq_sem( 1 ); + assert( status == E_OK ); + + puts( "Init - preq_sem - semaphore 1 unavailable - E_TMOUT" ); + status = preq_sem( 1 ); + assert( status == E_TMOUT ); + + puts( "Init - sig_sem - semaphore 1 (count --> 1) - E_OK" ); + status = sig_sem( 1 ); + assert( status == E_OK ); + + puts("Init - twai_sem(TMO_POL) - semaphore 1 available (count --> 0) - E_OK"); + status = twai_sem( 1, TMO_POL ); + assert( status == E_OK ); + + puts( "Init - twai_sem(TMO_POL) - semaphore 1 available - E_TMOUT" ); + status = twai_sem( 1, TMO_POL ); + assert( status == E_TMOUT ); + + /* + * Exercise twai_sem + */ + + puts( "Init - twai_sem - semaphore 1 unavailable - 1 second E_TMOUT" ); + put_time( "Init - starting to block at "); + status = twai_sem( 1, 1000 ); + assert( status == E_TMOUT ); + put_time( "Init - timed out at "); + puts( "Init - twai_sem - semaphore 1 unavailable - timeout completed" ); + + /* + * Now let's test exceed the maximum count of semaphore 1 + */ + + puts( "Init - sig_sem - semaphore 1 (count --> 1) - E_OK" ); + status = sig_sem( 1 ); + assert( status == E_OK ); + + puts( "Init - sig_sem - semaphore 1 (count --> 2) - E_OK" ); + status = sig_sem( 1 ); + assert( status == E_OK ); + + puts( "Init - sig_sem - semaphore 1 (count --> 3) - E_OK" ); + status = sig_sem( 1 ); + assert( status == E_OK ); + + puts( "Init - sig_sem - semaphore 1 (count > maximum) - E_QOVR" ); + status = sig_sem( 1 ); + assert( status == E_OK ); + + /* + * Exercise ref_sem + */ + + puts( "Init - ref_sem - NULL pk_sem returns E_PAR" ); + status = ref_sem( 1, NULL ); + assert( status == E_PAR ); + + puts( "Init - ref_sem - semaphore 1 - E_OK" ); + status = ref_sem( 1, &pk_rsem ); + assert( status == E_OK ); + printf( "Init - semaphore 1 count = %d\n", pk_rsem.semcnt ); + printf( "Init - semaphore 1 waiting tasks = %d\n", pk_rsem.wtsk ); + + puts( "Init - preq_sem - semaphore 1 (count --> 2) - E_OK" ); + status = preq_sem( 1 ); + assert( status == E_OK ); + + puts( "Init - ref_sem - semaphore 1 - E_OK" ); + status = ref_sem( 1, &pk_rsem ); + assert( status == E_OK ); + printf( "Init - semaphore 1 count = %d\n", pk_rsem.semcnt ); + printf( "Init - semaphore 1 waiting tasks = %d\n", pk_rsem.wtsk ); + + + /* + * Exercise del_sem + */ + + /* XXX really want another task blocking on the semaphore XXX */ + + puts( "Init - del_sem - semaphore 1 deleted - E_OK" ); + status = del_sem( 1 ); + assert( status == E_OK ); + + puts( "Init - XXX need other tasks to complete the test XXX" ); + + puts( "Init - dly_tsk - 1 second to let other task run" ); + status = dly_tsk( 1000 ); + assert( status == E_OK ); + + printf( "*** END OF ITRONSEM01 -- ITRON SEMAPHORE TEST ***\n" ); + exit( 0 ); +} diff --git a/c/src/tests/itrontests/itronsem01/system.h b/c/src/tests/itrontests/itronsem01/system.h new file mode 100644 index 0000000000..e3eac6012f --- /dev/null +++ b/c/src/tests/itrontests/itronsem01/system.h @@ -0,0 +1,39 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989-1998. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include +#include +#include + +/* functions */ + +void ITRON_Init( void ); + +/* configuration information */ + +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER + +#define CONFIGURE_ITRON_INIT_TASK_TABLE +#define CONFIGURE_MAXIMUM_ITRON_SEMAPHORES 10 + +#include + +/* global variables */ + +TEST_EXTERN rtems_id Global_variable; /* example global variable */ + +/* end of include file */ diff --git a/c/src/tests/itrontests/itrontask01/init.c b/c/src/tests/itrontests/itrontask01/init.c new file mode 100644 index 0000000000..3b36e2e9ec --- /dev/null +++ b/c/src/tests/itrontests/itrontask01/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. This test is based off of sp01. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989-1998. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + + +#define TEST_INIT +#include "system.h" + +#warning "Task_id is really an rtems_id" +void Task_1_through_3( void ){} + +void ITRON_Init( void ) +{ + rtems_time_of_day time; + ER status; + T_CTSK values; + + puts( "\n\n*** ITRONTASK01 - TICKER TEST ***" ); + + build_time( &time, 12, 31, 1988, 9, 0, 0, 0 ); + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + + values.exinf = NULL; + values.tskatr = TA_HLNG; + values.task = Task_1_through_3; + values.itskpri = 1; + values.stksz = RTEMS_MINIMUM_STACK_SIZE; + + status = cre_tsk( Task_id[1], &values ); + directive_failed( status, "cre_tsk of TA1" ); + + values.stksz = RTEMS_MINIMUM_STACK_SIZE; + status = cre_tsk( Task_id[2], &values ); + directive_failed( status, "cre_tsk of TA1" ); + + values.stksz = RTEMS_MINIMUM_STACK_SIZE; + status = cre_tsk( Task_id[3], &values ); + directive_failed( status, "cre_tsk of TA1" ); + +#if 0 + status = sta_tsk( Task_id[1] ); + directive_failed( status, "rtems_task_start of TA1" ); + + 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" ); +#endif +} diff --git a/c/src/tests/itrontests/itrontask01/system.h b/c/src/tests/itrontests/itrontask01/system.h new file mode 100644 index 0000000000..8a5b4ad378 --- /dev/null +++ b/c/src/tests/itrontests/itrontask01/system.h @@ -0,0 +1,39 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989-1998. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include +#include + +/* functions */ + +void ITRON_Init( void ); + +/* configuration information */ + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_ITRON_INIT_TASK_TABLE + +#define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE) + +#include + +/* global variables */ + +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ + +/* end of include file */ diff --git a/c/src/tests/samples/configure.in b/c/src/tests/samples/configure.in index fd2705cc0e..da5f09b402 100644 --- a/c/src/tests/samples/configure.in +++ b/c/src/tests/samples/configure.in @@ -14,6 +14,7 @@ AM_MAINTAINER_MODE RTEMS_ENABLE_MULTIPROCESSING RTEMS_ENABLE_POSIX +RTEMS_ENABLE_ITRON RTEMS_ENABLE_NETWORKING RTEMS_ENABLE_INLINES RTEMS_ENABLE_CXX diff --git a/c/src/tests/tmitrontests/Makefile.am b/c/src/tests/tmitrontests/Makefile.am new file mode 100644 index 0000000000..3b10073729 --- /dev/null +++ b/c/src/tests/tmitrontests/Makefile.am @@ -0,0 +1,21 @@ +## +## $Id$ +## + +AUTOMAKE_OPTIONS = foreign 1.4 +ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal + +project_bspdir = $(PROJECT_ROOT)/@RTEMS_BSP@ + +PREINSTALLDIRS = $(project_bspdir)/tests/screens/psxtests +$(PREINSTALLDIRS): + @$(mkinstalldirs) $@ + +all-local: $(PREINSTALLDIRS) + +ITRON_DIRS = include tmitronsem01 + +SUBDIRS = $(ITRON_DIRS) + +include $(top_srcdir)/../../../../automake/subdirs.am +include $(top_srcdir)/../../../../automake/local.am diff --git a/c/src/tests/tmitrontests/README b/c/src/tests/tmitrontests/README new file mode 100644 index 0000000000..65c5d4165d --- /dev/null +++ b/c/src/tests/tmitrontests/README @@ -0,0 +1,6 @@ +# +# $Id$ +# + +This directory contains the functionality tests for the ITRON 3.0 API +implementation. diff --git a/c/src/tests/tmitrontests/configure.in b/c/src/tests/tmitrontests/configure.in new file mode 100644 index 0000000000..28da189e75 --- /dev/null +++ b/c/src/tests/tmitrontests/configure.in @@ -0,0 +1,45 @@ +dnl Process this file with autoconf to produce a configure script. +dnl +dnl $Id$ + +AC_PREREQ(2.13) +AC_INIT(tmitronsem01) +RTEMS_TOP(../../../..) +AC_CONFIG_AUX_DIR(../../../..) + +RTEMS_CANONICAL_TARGET_CPU + +AM_INIT_AUTOMAKE(rtems-c-src-tests-tmitrontests,$RTEMS_VERSION,no) +AM_MAINTAINER_MODE + +RTEMS_ENABLE_INLINES +RTEMS_ENABLE_GCC28 +RTEMS_ENABLE_LIBCDIR +RTEMS_ENABLE_BARE + +RTEMS_ENV_RTEMSBSP +RTEMS_CHECK_CPU +RTEMS_CANONICAL_HOST + +RTEMS_PROJECT_ROOT + +RTEMS_PROG_CC_FOR_TARGET + +RTEMS_CANONICALIZE_TOOLS + +RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP) + +AC_SUBST(RTEMS_USE_GCC272) +AC_SUBST(BARE_CPU_CFLAGS) +AC_SUBST(BARE_CPU_MODEL) +AC_SUBST(CC_CFLAGS_DEFAULT) +AC_SUBST(CC_CFLAGS_DEBUG_V) +AC_SUBST(CC_CFLAGS_PROFILE_V) +AC_SUBST(CC_LDFLAGS_PROFILE_V) + +# Try to explicitly list a Makefile here +AC_OUTPUT( +Makefile +include/Makefile +tmitronsem01/Makefile +) diff --git a/c/src/tests/tmitrontests/include/Makefile.am b/c/src/tests/tmitrontests/include/Makefile.am new file mode 100644 index 0000000000..fcf88cb578 --- /dev/null +++ b/c/src/tests/tmitrontests/include/Makefile.am @@ -0,0 +1,9 @@ +## +## $Id$ +## + +AUTOMAKE_OPTIONS = foreign 1.4 + +noinst_HEADERS = timesys.h + +include $(top_srcdir)/../../../../automake/local.am diff --git a/c/src/tests/tmitrontests/include/timesys.h b/c/src/tests/tmitrontests/include/timesys.h new file mode 100644 index 0000000000..4f75a9abf2 --- /dev/null +++ b/c/src/tests/tmitrontests/include/timesys.h @@ -0,0 +1,55 @@ +/* timesys.h + * + * This header file contains the global variables for the Time + * suite. + * + * COPYRIGHT (c) 1989-1998. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +/* + * 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 unsigned32 end_time; /* ending time variable */ +TEST_EXTERN volatile unsigned32 overhead; /* loop overhead variable */ + +/* end of include file */ diff --git a/c/src/tests/tmitrontests/tmitronsem01/Makefile.in b/c/src/tests/tmitrontests/tmitronsem01/Makefile.in new file mode 100644 index 0000000000..8777928c69 --- /dev/null +++ b/c/src/tests/tmitrontests/tmitronsem01/Makefile.in @@ -0,0 +1,73 @@ +# +# $Id$ +# + +@SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +top_builddir = .. +subdir = tmitronsem01 + +RTEMS_ROOT = @RTEMS_ROOT@ +PROJECT_ROOT = @PROJECT_ROOT@ + +VPATH = @srcdir@ + +TEST = tmitronsem01 + +MANAGERS = all + +# C source names, if any, go here -- minus the .c +C_PIECES = init +C_FILES = $(C_PIECES:%=%.c) +C_O_FILES = $(C_PIECES:%=${ARCH}/%.o) + +H_FILES = system.h + +DOCTYPES = doc +DOCS = $(DOCTYPES:%=$(TEST).%) + +SRCS = $(DOCS) $(C_FILES) $(H_FILES) +OBJS = $(C_O_FILES) + +PRINT_SRCS = $(DOCS) + +PGM = ${ARCH}/$(TEST).exe + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(RTEMS_ROOT)/make/leaf.cfg + +INSTALL_CHANGE = @INSTALL_CHANGE@ +PACKHEX = @PACKHEX@ + +# +# (OPTIONAL) Add local stuff here using += +# + +DEFINES += +CPPFLAGS += -I$(srcdir)/../include +CFLAGS += + +LD_PATHS += +LD_LIBS += +LDFLAGS += + +# +# Add your list of files to delete here. The config files +# already know how to delete some stuff, so you may want +# to just run 'make clean' first to see what gets missed. +# 'make clobber' already includes 'make clean' +# + +CLEAN_ADDITIONS += +CLOBBER_ADDITIONS += + +all: ${ARCH} $(SRCS) $(PGM) + @$(INSTALL_VARIANT) -m 755 ${PGM} $(PROJECT_RELEASE)/tests + +${PGM}: $(OBJS) $(LINK_FILES) + $(make-exe) + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status diff --git a/c/src/tests/tmitrontests/tmitronsem01/init.c b/c/src/tests/tmitrontests/tmitronsem01/init.c new file mode 100644 index 0000000000..396d45d04b --- /dev/null +++ b/c/src/tests/tmitrontests/tmitronsem01/init.c @@ -0,0 +1,141 @@ +/* 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 + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#define TEST_INIT +#include "system.h" +#include +#include + +void ITRON_Init( void ) +{ + T_CSEM pk_csem; + T_RSEM pk_rsem; + int index; + + pk_csem.isemcnt = 2; + pk_csem.maxsem = 3; + pk_csem.sematr = TA_TFIFO; + + printf( "\n\n*** TMITRON01 -- ITRON TIMING TEST ***\n" ); + + /* + * time one invocation of cre_sem + */ + + Timer_initialize(); + (void) cre_sem( 1, &pk_csem ); + end_time = Read_timer(); + put_time( + "cre_sem", + end_time, + 1, + 0, /* no loop overhead to take out */ + 0 /* no calling overhead */ + ); + + /* + * time one invocation of del_sem + */ + + Timer_initialize(); + (void) del_sem( 1 ); + end_time = Read_timer(); + put_time( + "del_sem", + end_time, + 1, + 0, /* no loop overhead to take out */ + 0 /* no calling overhead */ + ); + + pk_csem.isemcnt = 100; + pk_csem.maxsem = 100; + pk_csem.sematr = TA_TFIFO; + (void) cre_sem( 1, &pk_csem ); + + /* + * time preq_sem (available) + */ + + Timer_initialize(); + for ( index = 1 ; index<=OPERATION_COUNT ; index++ ) + (void) preq_sem( 1 ); + end_time = Read_timer(); + put_time( + "preq_sem (available)", + end_time, + OPERATION_COUNT, + 0, /* don't take the loop overhead out */ + 0 /* no calling overhead */ + ); + + /* + * time preq_sem (not available) + */ + + Timer_initialize(); + for ( index = 1 ; index<=OPERATION_COUNT ; index++ ) + (void) preq_sem( 1 ); + end_time = Read_timer(); + put_time( + "preq_sem (not available)", + end_time, + OPERATION_COUNT, + 0, /* don't take the loop overhead out */ + 0 /* no calling overhead */ + ); + + /* + * time sig_sem (no waiting tasks) + */ + + Timer_initialize(); + for ( index = 1 ; index<=OPERATION_COUNT ; index++ ) + (void) sig_sem( 1 ); + end_time = Read_timer(); + put_time( + "sig_sem (no waiting tasks)", + end_time, + OPERATION_COUNT, + 0, /* don't take the loop overhead out */ + 0 /* no calling overhead */ + ); + + /* + * time ref_sem + */ + + Timer_initialize(); + for ( index = 1 ; index<=OPERATION_COUNT ; index++ ) + (void) ref_sem( 1, &pk_rsem ); + end_time = Read_timer(); + put_time( + "ref_sem", + end_time, + OPERATION_COUNT, + 0, /* don't take the loop overhead out */ + 0 /* no calling overhead */ + ); + + printf( "\n\nXXX ADD BLOCKING AND PREEMPTING TIME TESTS\n\n" ); + + + printf( "*** END OF TMITRON01 -- ITRON TIMING TEST ***\n" ); + exit( 0 ); +} diff --git a/c/src/tests/tmitrontests/tmitronsem01/system.h b/c/src/tests/tmitrontests/tmitronsem01/system.h new file mode 100644 index 0000000000..0537ae527a --- /dev/null +++ b/c/src/tests/tmitrontests/tmitronsem01/system.h @@ -0,0 +1,39 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989-1998. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include +#include +#include + +/* functions */ + +void ITRON_Init( void ); + +/* configuration information */ + +#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER + +#define CONFIGURE_ITRON_INIT_TASK_TABLE +#define CONFIGURE_MAXIMUM_ITRON_SEMAPHORES 100 + +#include + +/* global variables */ + +TEST_EXTERN rtems_id Global_variable; /* example global variable */ + +/* end of include file */ diff --git a/c/src/tests/tmitrontests/tmitronsem01/tmitronsem01.doc b/c/src/tests/tmitrontests/tmitronsem01/tmitronsem01.doc new file mode 100644 index 0000000000..558f0594c8 --- /dev/null +++ b/c/src/tests/tmitrontests/tmitronsem01/tmitronsem01.doc @@ -0,0 +1,9 @@ +# +# $Id$ +# +# The license and distribution terms for this file may be +# found in the file LICENSE in this distribution or at +# http://www.OARcorp.com/rtems/license.html. +# + +Time some basic ITRON semaphore operations diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am index f4e7e0a9e9..3677d657e4 100644 --- a/cpukit/Makefile.am +++ b/cpukit/Makefile.am @@ -9,7 +9,11 @@ if HAS_POSIX POSIX_SUBDIRS = posix endif -SUBDIRS = score rtems $(POSIX_SUBDIRS) sapi wrapup +if HAS_ITRON +ITRON_SUBDIRS = itron +endif + +SUBDIRS = score rtems $(POSIX_SUBDIRS) $(ITRON_SUBDIRS) sapi wrapup include $(top_srcdir)/../../../automake/subdirs.am include $(top_srcdir)/../../../automake/local.am diff --git a/cpukit/itron/Makefile.am b/cpukit/itron/Makefile.am new file mode 100644 index 0000000000..294450228e --- /dev/null +++ b/cpukit/itron/Makefile.am @@ -0,0 +1,11 @@ +## +## $Id$ +## + +AUTOMAKE_OPTIONS = foreign 1.4 +ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal + +SUBDIRS = include inline src + +include $(top_srcdir)/../../../../automake/subdirs.am +include $(top_srcdir)/../../../../automake/local.am diff --git a/cpukit/itron/include/Makefile.am b/cpukit/itron/include/Makefile.am new file mode 100644 index 0000000000..f83468dd1b --- /dev/null +++ b/cpukit/itron/include/Makefile.am @@ -0,0 +1,27 @@ +## +## $Id$ +## + +AUTOMAKE_OPTIONS = foreign 1.4 + +H_PIECES = itron.h + +noinst_HEADERS = $(H_PIECES) + +TMPINSTALL_FILES = \ +$(PROJECT_INCLUDE) \ +$(noinst_HEADERS:%=$(PROJECT_INCLUDE)/%) + +$(PROJECT_INCLUDE): + @$(mkinstalldirs) $@ +$(PROJECT_INCLUDE)/%.h: %.h + $(INSTALL_DATA) $< $@ + +all-am: $(TMPINSTALL_FILES) +debug-am: $(TMPINSTALL_FILES) +profile-am: $(TMPINSTALL_FILES) + +SUBDIRS = rtems itronsys + +include $(top_srcdir)/../../../../automake/subdirs.am +include $(top_srcdir)/../../../../automake/local.am diff --git a/cpukit/itron/include/itron.h b/cpukit/itron/include/itron.h new file mode 100644 index 0000000000..2b6d2442f9 --- /dev/null +++ b/cpukit/itron/include/itron.h @@ -0,0 +1,49 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_h_ +#define __ITRON_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Include the basic requirements + */ + +#include /* basic RTEMS types defined by */ + /* each port */ +#include /* define all the TRON types */ + /* in terms of the RTEMS base types */ +#include /* define all ITRON status codes */ + +/* + * Now include the per manager include files + */ + +#include +#include +#include +#include +#include +#include /* network depends on this file */ +#include +#include +#include +#include +#include +#include + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/include/itronsys/README b/cpukit/itron/include/itronsys/README new file mode 100644 index 0000000000..8191ad3c5f --- /dev/null +++ b/cpukit/itron/include/itronsys/README @@ -0,0 +1,9 @@ +# +# $Id$ +# + +This directory contains the public interface of each manager. +Each file in this directory is included from . + +The private header file for each ITRON manager is in +../rtems/itron. \ No newline at end of file diff --git a/cpukit/itron/include/itronsys/eventflags.h b/cpukit/itron/include/itronsys/eventflags.h new file mode 100644 index 0000000000..27224404f7 --- /dev/null +++ b/cpukit/itron/include/itronsys/eventflags.h @@ -0,0 +1,143 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_EVENTFLAGS_h_ +#define __ITRON_EVENTFLAGS_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Create Eventflags (cre_flg) Structure + */ + +typedef struct t_cflg { + VP exinf; /* extended information */ + ATR flgatr; /* eventflag attribute */ + UINT iflgptn; /* initial eventflag */ + /* additional information may be included depending on the implementation */ +} T_CFLG; + +/* + * flgatr + */ + +#define TA_WSGL 0x00 /* multiple tasks are not allowed to wait (Wait + Single Task) */ +#define TA_WMUL 0x08 /* multiple tasks are allowed to wait (Wait + Multiple Task) */ + +/* + * wfmode + */ + +#define TWF_ANDW 0x00 /* AND wait */ +#define TWF_ORW 0x02 /* OR wait */ +#define TWF_CLR 0x01 /* clear specification */ + +/* + * Reference Eventflags (ref_flg) Structure + */ + +typedef struct t_rflg { + VP exinf; /* extended information */ + BOOL_ID wtsk; /* indicates whether or not there is a waiting task */ + UINT flgptn; /* eventflag bit pattern */ + /* additional information may be included depending on the implementation */ +} T_RFLG; + +/* + * Eventflag Functions + */ + +/* + * cre_flg - Create Eventflag + */ + +ER cre_flg( + ID flgid, + T_CFLG *pk_cflg +); + +/* + * del_flg - Delete Eventflag + */ + +ER del_flg( + ID flgid +); + +/* + * set_flg - Set Eventflag + */ + +ER set_flg( + ID flgid, + UINT setptn +); + +/* + * clr_flg - Clear Eventflag + */ + +ER clr_flg( + ID flgid, + UINT clrptn +); + +/* + * wai_flg - Wait on Eventflag + */ + +ER wai_flg( + UINT *p_flgptn, + ID flgid, + UINT waiptn, + UINT wfmode +); + +/* + * pol_flg - Wait for Eventflag(Polling) + */ + +ER pol_flg( + UINT *p_flgptn, + ID flgid, + UINT waiptn, + UINT wfmode +); + +/* + * twai_flg - Wait on Eventflag with Timeout + */ + +ER twai_flg( + UINT *p_flgptn, + ID flgid, + UINT waiptn, + UINT wfmode, + TMO tmout +); + +/* + * ref_flg - Reference Eventflag Status + */ + +ER ref_flg( + T_RFLG *pk_rflg, + ID flgid +); + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/include/itronsys/fmempool.h b/cpukit/itron/include/itronsys/fmempool.h new file mode 100644 index 0000000000..fa72c8eb31 --- /dev/null +++ b/cpukit/itron/include/itronsys/fmempool.h @@ -0,0 +1,122 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_FIXED_MEMORYPOOL_h_ +#define __ITRON_FIXED_MEMORYPOOL_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Create Fixed Memory Pool (cre_mpf) Structure + */ + + /* cre_mpf */ +typedef struct t_cmpf { + VP exinf; /* extended information */ + ATR mpfatr; /* memorypool attributes */ + INT mpfcnt; /* block count for entire memorypool */ + INT blfsz; /* fixed-size memory block size */ + /* additional information may be included depending on the implementation */ +} T_CMPF; + +/* + * mpfatr + */ + +#define TA_TFIFO 0x00 /* waiting tasks are handled by FIFO */ +#define TA_TPRI 0x01 /* waiting tasks are handled by priority */ + + +/* + * Reference Fixed Memory Pool (ref_mpf) Structure + */ + + /* ref_mpf */ +typedef struct t_rmpf { + VP exinf; /* extended information */ + BOOL_ID wtsk; /* indicates whether or not there are waiting tasks */ + INT frbcnt; /* free block count */ + /* additional information may be included depending on the implementation */ +} T_RMPF; + +/* + * Fixed Memory Pool Functions + */ + +/* + * cre_mpf - Create Fixed-Size Memorypool + */ + +ER cre_mpf( + ID mpfid, + T_CMPF *pk_cmpf +); + +/* + * del_mpf - Delete Fixed-Size Memorypool + */ + +ER del_mpf( + ID mpfid +); + +/* + * get_blf - Get Fixed-Size Memory Block + */ + +ER get_blf( + VP *p_blf, + ID mpfid +); + +/* + * pget_blf - Poll and Get Fixed-Size Memory Block + */ + +ER pget_blf( + VP *p_blf, + ID mpfid +); + +/* + * tget_blf - Get Fixed-Size Memory Block with Timeout + */ + +ER tget_blf( + VP *p_blf, + ID mpfid, + TMO tmout +); + +/* + * rel_blf - Release Fixed-Size Memory Block + */ + +ER rel_blf( + ID mpfid, + VP blf +); + +/* + * ref_mpf - Reference Fixed-Size Memorypool Status + */ + +ER ref_mpf( + T_RMPF *pk_rmpf, + ID mpfid +); + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/include/itronsys/intr.h b/cpukit/itron/include/itronsys/intr.h new file mode 100644 index 0000000000..07f0c038f2 --- /dev/null +++ b/cpukit/itron/include/itronsys/intr.h @@ -0,0 +1,103 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_INTERRUPT_h_ +#define __ITRON_INTERRUPT_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Define Interrupt (def_int) Structure + */ + +typedef struct t_dint { + ATR intatr; /* interrupt handler attributes */ + FP inthdr; /* interrupt handler address */ + /* additional information may be included depending on the implementation */ +} T_DINT; + +/* + * Interrupt Functions + */ + +/* + * def_int - Define Interrupt Handler + */ + +ER def_int( + UINT dintno, + T_DINT *pk_dint +); + +/* + * ret_int - Return from Interrupt Handler + */ + +void ret_int( void ); + +/* + * ret_wup - Return and Wakeup Task + */ + +void ret_wup( + ID tskid +); + +/* + * loc_cpu - Lock CPU + */ + +ER loc_cpu( void ); + +/* + * unl_cpu - Unlock CPU + */ + +ER unl_cpu( void ); + +/* + * dis_int - Disable Interrupt + */ + +ER dis_int( + UINT eintno +); + +/* + * ena_int - Enable Interrupt + */ + +ER ena_int( + UINT eintno +); + +/* + * chg_iXX - Change Interrupt Mask(Level or Priority) + */ + +ER chg_iXX( + UINT iXXXX +); + +/* + * ref_iXX - Reference Interrupt Mask(Level or Priority) + */ + +ER ref_iXX( + UINT *p_iXXXX +); + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/include/itronsys/mbox.h b/cpukit/itron/include/itronsys/mbox.h new file mode 100644 index 0000000000..ef0581d02e --- /dev/null +++ b/cpukit/itron/include/itronsys/mbox.h @@ -0,0 +1,131 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_MBOX_h_ +#define __ITRON_MBOX_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Create Mailbox (cre_mbx) Structure + */ + +typedef struct t_cmbx { + VP exinf; /* extended information */ + ATR mbxatr; /* mailbox attributes */ + /* Following is implementation-dependent function */ + INT bufcnt; /* ring buffer size */ + /* additional information may be included depending on the implementation */ +} T_CMBX; + +/* + * mbxatr + */ + +#define TA_TFIFO 0x00 /* waiting tasks are handled by FIFO */ +#define TA_TPRI 0x01 /* waiting tasks are handled by priority */ +#define TA_MFIFO 0x00 /* messages are handled by FIFO */ +#define TA_MPRI 0x02 /* messages are handled by priority */ + +typedef struct t_msg { + /* + * A region (header) reserved by the OS may be included first + * depending on the implementation. + */ + /* VB msgcont[]; XXX */ + unsigned8 msgcont[1]; +} T_MSG; + +/* + * Reference Mailbox (ref_mbx) Structure + */ + +typedef struct t_rmbx { + VP exinf; /* extended information */ + BOOL_ID wtsk; /* indicates whether or not there is a waiting task */ + T_MSG *pk_msg; /* message to be sent next */ + /* additional information may be included depending on the implementation */ +} T_RMBX; + +/* + * Mailbox Functions + */ + +/* + * cre_mbx - Create Mailbox + */ + +ER cre_mbx( + ID mbxid, + T_CMBX* pk_cmbx +); + +/* + * del_mbx - Delete Mailbox + */ + +ER del_mbx( + ID mbxid +); + +/* + * snd_msg - Send Message to Mailbox + */ + +ER snd_msg( + ID mbxid, + T_MSG *pk_msg +); + +/* + * rcv_msg - Receive Message from Mailbox + */ + +ER rcv_msg( + T_MSG **ppk_msg, + ID mbxid +); + +/* + * prcv_msg - Poll and Receive Message from Mailbox + */ + +ER prcv_msg( + T_MSG **ppk_msg, + ID mbxid +); + +/* + * trcv_msg - Receive Message from Mailbox with Timeout + */ + +ER trcv_msg( + T_MSG **ppk_msg, + ID mbxid, + TMO tmout +); + +/* + * ref_mbx - Reference Mailbox Status + */ + +ER ref_mbx( + T_RMBX *pk_rmbx, + ID mbxid +); + + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/include/itronsys/msgbuffer.h b/cpukit/itron/include/itronsys/msgbuffer.h new file mode 100644 index 0000000000..20a7563851 --- /dev/null +++ b/cpukit/itron/include/itronsys/msgbuffer.h @@ -0,0 +1,157 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_MESSAGEBUFFER_h_ +#define __ITRON_MESSAGEBUFFER_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Create Message Buffer (cre_mbf) Structure + */ + +typedef struct t_cmbf { + VP exinf; /* extended information */ + ATR mbfatr; /* messagebuffer attributes */ + INT bufsz; /* messagebuffer size */ + INT maxmsz; /* maximum size of messages */ + /* additional information may be included depending on the implementation */ +} T_CMBF; + +/* + * mbfatr + */ + +#define TA_TFIFO 0x00 /* tasks waiting to receive messages are handled + by FIFO */ +#define TA_TPRI 0x01 /* tasks waiting to receive messages are handled + by priority */ + +/* + * mbfid + */ + +#define TMBF_OS (-4) /* messagebuffer used for OS error log */ +#define TMBF_DB (-3) /* messagebuffer used for debugging */ + +/* + * Reference Message Buffer (ref_mbf) Structure + */ + +typedef struct t_rmbf { + VP exinf; /* extended information */ + BOOL_ID wtsk; /* indicates whether or not there is a */ + /* task waiting to receive a message */ + BOOL_ID stsk; /* indicates whether or not there is a */ + /* task waiting to send a message */ + INT msgsz; /* size of message to be sent next */ + INT frbufsz; /* size of free buffer */ + /* additional information may be included depending on the implementation */ +} T_RMBF; + +/* + * Message Buffer Functions + */ + +/* + * cre_mbf - Create MessageBuffer + */ + +ER cre_mbf( + ID mbfid, + T_CMBF *pk_cmbf +); + +/* + * del_mbf - Delete MessageBuffer + */ + +ER del_mbf( + ID mbfid +); + +/* + * snd_mbf - Send Message to MessageBuffer + */ + +ER snd_mbf( + ID mbfid, + VP msg, + INT msgsz +); + +/* + * psnd_mbf - Poll and Send Message to MessageBuffer + */ + +ER psnd_mbf( + ID mbfid, + VP msg, + INT msgsz +); + +/* + * tsnd_mbf - Send Message to MessageBuffer with Timeout + */ + +ER tsnd_mbf( + ID mbfid, + VP msg, + INT msgsz, + TMO tmout +); + +/* + * rcv_mbf - Receive Message from MessageBuffer + */ + +ER rcv_mbf( + VP msg, + INT *p_msgsz, + ID mbfid +); + +/* + * prcv_mbf - Poll and Receive Message from MessageBuffer + */ + +ER prcv_mbf( + VP msg, + INT *p_msgsz, + ID mbfid +); + +/* + * trcv_mbf - Receive Message from MessageBuffer with Timeout + */ + +ER trcv_mbf( + VP msg, + INT *p_msgsz, + ID mbfid, + TMO tmout +); + +/* + * ref_mbf - Reference MessageBuffer Status + */ + +ER ref_mbf( + T_RMBF *pk_rmbf, + ID mbfid +); + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/include/itronsys/network.h b/cpukit/itron/include/itronsys/network.h new file mode 100644 index 0000000000..21e3e0941c --- /dev/null +++ b/cpukit/itron/include/itronsys/network.h @@ -0,0 +1,75 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_NETWORK_h_ +#define __ITRON_NETWORK_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * NODE srcnode, dstnode, nod: + */ + +#define TND_SELF 0 /* specifies the local node */ +#define TND_OTHR (-1) /* specifies default remote node */ + +/* + * Network Functions + */ + +/* + * nrea_dat - Read Data from another Node + */ + +ER nrea_dat( + INT *p_reasz, + VP dstadr, + NODE srcnode, + VP srcadr, + INT datsz +); + +/* + * nwri_dat - Write Data to another Node + */ + +ER nwri_dat( + INT *p_wrisz, + NODE dstnode, + VP dstadr, + VP srcadr, + INT datsz +); + +/* + * nget_nod - Get Local Node Number + */ + +ER nget_nod( + NODE *p_node +); + +/* + * nget_ver - Get Version Information of another Node + */ + +ER nget_ver( + T_VER *pk_ver, + NODE node +); + + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/include/itronsys/port.h b/cpukit/itron/include/itronsys/port.h new file mode 100644 index 0000000000..a8935b403f --- /dev/null +++ b/cpukit/itron/include/itronsys/port.h @@ -0,0 +1,187 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_PORT_h_ +#define __ITRON_PORT_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Create Port (cre_por) Structure + */ + +typedef struct t_cpor { + VP exinf; /* extended information */ + ATR poratr; /* port attributes */ + INT maxcmsz; /* maximum call message size */ + INT maxrmsz; /* maximum reply message size */ + /* additional information may be included depending on the implementation */ +} T_CPOR; + +/* + * poratr + */ + +#define TA_NULL 0 /* specifies no particular attributes */ + +/* + * TA_NULL should be used in place of zeroes to turn off all + * attribute features. + */ + +/* + * Reference Port (ref_por) Structure + */ + +typedef struct t_rpor { + VP exinf; /* extended information */ + BOOL_ID wtsk; /* indicates whether or not there is a task */ + /* waiting to call a rendezvous */ + BOOL_ID atsk; /* indicates whether or not there is a task */ + /* waiting to accept a rendezvous */ + /* additional information may be included depending on the implementation */ +} T_RPOR; + +/* + * Port Functions + */ + +/* + * cre_por - Create Port for Rendezvous + */ + +ER cre_por( + ID porid, + T_CPOR *pk_cpor +); + +/* + * del_por - Delete Port for Rendezvous + */ + +ER del_por( + ID porid +); + +/* + * cal_por - Call Port for Rendezvous Poll + */ + +ER cal_por( + VP msg, + INT *p_rmsgsz, + ID porid, + UINT calptn, + INT cmsgsz +); + +/* + * pcal_por - Poll and Call Port for Rendezvous + */ + +ER pcal_por( + VP msg, + INT *p_rmsgsz, + ID porid, + UINT calptn, + INT cmsgsz +); + +/* + * tcal_por - Call Port for Rendezvous with Timeout + */ + +ER tcal_por( + VP msg, + INT *p_rmsgsz, + ID porid, + UINT calptn, + INT cmsgsz, + TMO tmout +); + +/* + * acp_por - Accept Port for Rendezvous Poll + */ + +ER acp_por( + RNO *p_rdvno, + VP msg, + INT *p_cmsgsz, + ID porid, + UINT acpptn +); + +/* + * pacp_por - Poll and Accept Port for Rendezvous + */ + +ER pacp_por( + RNO *p_rdvno, + VP msg, + INT *p_cmsgsz, + ID porid, + UINT acpptn +); + +/* + * tacp_por - Accept Port for Rendezvous with Timeout + */ + +ER tacp_por( + RNO *p_rdvno, + VP msg, + INT *p_cmsgsz, + ID porid, + UINT acpptn, + TMO tmout +); + +/* + * fwd_por - Forward Rendezvous to Other Port + */ + +ER fwd_por( + ID porid, + UINT calptn, + RNO rdvno, + VP msg, + INT cmsgsz +); + +/* + * rpl_rdv - Reply Rendezvous + */ + +ER rpl_rdv( + RNO rdvno, + VP msg, + INT rmsgsz +); + +/* + * ref_por - Reference Port Status + */ + +ER ref_por( + T_RPOR *pk_rpor, + ID porid +); + + + + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/include/itronsys/semaphore.h b/cpukit/itron/include/itronsys/semaphore.h new file mode 100644 index 0000000000..c149012dad --- /dev/null +++ b/cpukit/itron/include/itronsys/semaphore.h @@ -0,0 +1,118 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_SEMAPHORE_h_ +#define __ITRON_SEMAPHORE_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Create Semaphore (cre_sem) Structure + */ + +typedef struct t_csem { + VP exinf; /* extended information */ + ATR sematr; /* semaphore attributes */ + /* Following is the extended function for [level X]. */ + INT isemcnt; /* initial semaphore count */ + INT maxsem; /* maximum semaphore count */ + /* additional information may be included depending on the implementation */ +} T_CSEM; + +/* + * sematr - Semaphore Attribute Values + */ + +#define TA_TFIFO 0x00 /* waiting tasks are handled by FIFO */ +#define TA_TPRI 0x01 /* waiting tasks are handled by priority */ + +#define _ITRON_SEMAPHORE_UNUSED_ATTRIBUTES ~(TA_TPRI) + +/* + * Reference Semaphore (ref_sem) Structure + */ + +typedef struct t_rsem { + VP exinf; /* extended information */ + BOOL_ID wtsk; /* indicates whether or not there is a waiting task */ + INT semcnt; /* current semaphore count */ + /* additional information may be included depending on the implementation */ +} T_RSEM; + +/* + * Semaphore Functions + */ + +/* + * cre_sem - Create Semaphore + */ + +ER cre_sem( + ID semid, + T_CSEM *pk_csem +); + +/* + * del_sem - Delete Semaphore + */ + +ER del_sem( + ID semid +); + +/* + * sig_sem - Signal Semaphore + */ + +ER sig_sem( + ID semid +); + +/* + * wai_sem - Wait on Semaphore + */ + +ER wai_sem( + ID semid +); + +/* + * preq_sem - Poll and Request Semaphore + */ + +ER preq_sem( + ID semid +); + +/* + * twai_sem - Wait on Semaphore with Timeout + */ + +ER twai_sem( + ID semid, + TMO tmout +); + +/* + * ref_sem - Reference Semaphore Status + */ + +ER ref_sem( + ID semid, + T_RSEM *pk_rsem +); + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/include/itronsys/status.h b/cpukit/itron/include/itronsys/status.h new file mode 100644 index 0000000000..c2a640ba6a --- /dev/null +++ b/cpukit/itron/include/itronsys/status.h @@ -0,0 +1,67 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_STATUS_h_ +#define __ITRON_STATUS_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +#define E_OK 0 /* Normal completion */ +#define E_SYS (-5) /* System error */ +#define E_NOMEM (-10) /* Insufficient memory */ +#define E_NOSPT (-17) /* Feature not supported */ +#define E_INOSPT (-18) /* Feature not supported by ITRON/FILE */ + /* specification */ +#define E_RSFN (-20) /* Reserved function code number */ +#define E_RSATR (-24) /* Reserved attribute */ +#define E_PAR (-33) /* Parameter error */ +#define E_ID (-35) /* Invalid ID number */ +#define E_NOEXS (-52) /* Object does not exist */ +#define E_OBJ (-63) /* Invalid object state */ +#define E_MACV (-65) /* Memory access disabled or memory access */ + /* violation */ +#define E_OACV (-66) /* Object access violation */ +#define E_CTX (-69) /* Context error */ +#define E_QOVR (-73) /* Queuing or nesting overflow */ +#define E_DLT (-81) /* Object being waited for was deleted */ +#define E_TMOUT (-85) /* Polling failure or timeout exceeded */ +#define E_RLWAI (-86) /* WAIT state was forcibly released */ +#define EN_NOND (-113) /* Target node does not exist or cannot be */ + /* accessed */ +#define EN_OBJNO (-114) /* Specifies an object number which could not be */ + /* accessed on the target node */ +#define EN_PROTO (-115) /* Protocol not supported on target node */ +#define EN_RSFN (-116) /* System call or function not supported on */ + /* target node */ +#define EN_COMM (-117) /* No response from target node */ +#define EN_RLWAI (-118) /* Connection function response wait state was */ + /* forcibly released */ +#define EN_PAR (-119) /* A value outside the range supported by the */ + /* target node and/or transmission packet */ + /* format was specified as a parameter */ +#define EN_RPAR (-120) /* A value outside the range supported by the */ + /* issuing node and/or transmission packet */ + /* format was returned as a return parameter */ +#define EN_CTXID (-121) /* An object on another node was specified to */ + /* a system call issued from a task in dispatch */ + /* disabled state or from a task-independent */ + /* portion */ +#define EN_EXEC (-122) /* System call could not be executed due to */ + /* insufficient resources on the target node */ +#define EN_NOSPT (-123) /* Connection function not supported */ + + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/include/itronsys/sysmgmt.h b/cpukit/itron/include/itronsys/sysmgmt.h new file mode 100644 index 0000000000..21076cdca4 --- /dev/null +++ b/cpukit/itron/include/itronsys/sysmgmt.h @@ -0,0 +1,316 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_SYSTEM_MANAGEMENT_h_ +#define __ITRON_SYSTEM_MANAGEMENT_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Get Version (get_ver) Structure + */ + +typedef struct t_ver { + UH maker; /* vendor */ + UH id; /* format number */ + UH spver; /* specification version */ + UH prver; /* product version */ + UH prno[4]; /* product control information */ + UH cpu; /* CPU information */ + UH var; /* variation descriptor */ +} T_VER; + +/* + * Specific MAKER codes established as of March, 1993 are as follows. + * Due to restrictions on the assignment of CPU codes described below, it is + * necessary to use maker codes in the range 0x000 through 0x00ff for vendors + * developing CPUs. + */ + +/* + * CPU defines XXX need to name the constants + */ + +#if 0 +#define 0x000 /* No version (test systems, etc.) */ +#define 0x001 /* University of Tokyo */ +#define 0x009 /* FUJITSU LIMITED */ +#define 0x00a /* Hitachi, Ltd. */ +#define 0x00b /* Matsushita Electric Industrial Co., Ltd. */ +#define 0x00c /* Mitsubishi Electric Corporation */ +#define 0x00d /* NEC Corporation */ +#define 0x00e /* Oki Electric Industry Co., Ltd. */ +#define 0x00f /* TOSHIBA CORPORATION */ +#endif + +/* + * The above have been assigned in alphabetical order. + */ + +#if 0 +#define 0x010 /* ALPS ELECTRIC CO., LTD. */ +#define 0x011 /* WACOM Co., Ltd. */ +#define 0x012 /* Personal Media Corporation */ +#define 0x101 /* OMRON CORPORATION */ +#define 0x102 /* SEIKOSHA CO., LTD. */ +#define 0x103 /* SYSTEM ALGO CO., LTD. */ +#define 0x104 /* Tokyo Computer Service Co., Ltd. */ +#define 0x105 /* YAMAHA CORPORATION */ +#define 0x106 /* MORSON JAPAN */ +#define 0x107 /* TOSHIBA INFORMATION SYSTEMS (JAPAN) CORP. */ +#define 0x108 /* Miyazaki System Planning Office */ +#define 0x109 /* Three Ace Computer Corporation */ +#endif + +/* + * CPU Codes + * + * Figure 47 shows the format of cpu code. Some processors use the format + * given in Figure 47(1). The format given in Figure 47(2) is used for all + * other proprietary processors. + * + * The code assignment of the CPU1 region in the format given in Figure 47(1) + * is common to ITRON and BTRON specifications. The same number is used in + * the CPU type of the standard object format of BTRON specification + * operating systems implemented on a TRON-specification chip. + * + * When using the format given in Figure 47(2) the code used for MAKER1 is + * assigned by using the lower 8 bits of MAKER described in the previous + * subsection. The code assignment of CPU2 is left up to each maker. + * + * + * + * +---------------+---------------+---------------+---------------+ + * (1) | 0 0 0 0 0 0 0 0 | CPU1 | + * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ + * +---------------+---------------+---------------+---------------+ + * (2) | MAKER1 | CPU2 | + * +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+ + * + * Figure 47 Format of cpu Returned by get_ver + * + * + * Specific CPU codes established as of March, 1993 are as follows. + */ + +#if 0 +/* + * XXX CONVERT THESE to #defines + */ + + +/* + * Contents of the CPU1 field + */ + +#define (0x0) CPU unspecified, no CPU information given +#define (0x1) TRONCHIP32 shared +#define (0x2) reserved +#define (0x3) reserved +#define (0x4) reserved +#define (0x5) reserved (<> TRON-specification chip) +#define (0x6) reserved (<> TRON-specification chip) +#define (0x7) reserved (TRON-specification chip supporting the + LSID function) +/* CPU vendors are unspecified for codes B'00000000 through B'00000111. */ + +#define (0x8) reserved +#define (0x9) GMICRO/100 +#define (0xa) GMICRO/200 +#define (0xb) GMICRO/300 +#define (0xc) reserved +#define (0xd) TX1 +#define (0xe) TX2 +#define (0xf) reserved + +#define (0x10) reserved +#define (0x11) reserved +#define (0x12) reserved +#define (0x13) O32 +#define (0x14) reserved +#define (0x15) MN10400 +#define (0x16) reserved +#define (0x17) reserved + +#define (0x18) GMICRO/400 +#define (0x19) GMICRO/500 +#define (0x1a) reserved +#define (0x1b-0x3f) + reserved + * For GMICRO extended, TX series extended, and TRONCHIP64 chips. + +#define (0x40) Motorola 68000 +#define (0x41) Motorola 68010 +#define (0x42) Motorola 68020 +#define (0x43) Motorola 68030 +#define (0x44) Motorola 68040 +#define -(0x40-0x4f) +#define Motorola 68000 family +#define (0x50) National Semiconductor NS32032 +#define (0x50-0x5f) + National Semiconductor NS32000 family +#define (0x60) Intel 8086, 8088 +#define (0x61) Intel 80186 +#define (0x62) Intel 80286 +#define (0x63) Intel 80386 +#define (0x64) Intel 80486 +#define (0x60-0x6f) + Intel iAPX86 family + +#define (0x70-0x7f) + NEC V Series + +#define (0x80-0xff) + reserved +#endif + +/* + * Assigning Version Numbers + * + * The version numbers of ITRON and uITRON specifications take the following + * form. + * + * Ver X.YY.ZZ[.WW] + * + * where "X" represents major version number of the ITRON specification to + * distinguish ITRON1, ITRON2 and uITRON 3.0 specifications. Specific + * assignment is as follows. + * + * "X" = 1 ITRON1 specification + * = 2 ITRON2 or uITRON 2.0 specification + * = 3 uITRON 3.0 specification + * + * "YY" is a number used to distinguish versions according to changes and + * additions made to the specification. After the specification is published, + * this number is incremented in order "YY" = 00, 01, 02... according to + * version upgrades. The first digit of "YY" is 'A', 'B' or 'C' for draft + * standard versions and test versions within the TRON Association before the + * specification have been published. + * + * The "X.YY" part of the specification version numbers is returned by spver + * to get_ver system call. The corresponding hexadecimal value is used when + * "YY" includes 'A', 'B' or 'C'. + * + * "ZZ" represents a number used to distinguish versions related to the written + * style of a specification. This number is incremented in order + * "ZZ" = 00, 01, 02... when there have been changes in specification + * configuration, reordering of chapters or corrections of misprints. + * When a further distinction of the written style of specifications is + * desired, ".WW" may be added optionally after "ZZ". WW will be assumed + * to be zero if ".WW" is omitted. + */ + +/* + * Reference System (ref_sys) Structure + */ + +typedef struct t_rsys { + INT sysstat; /* system state */ + /* additional information may be included depending on the implementation */ +} T_RSYS; + +/* + * sysstat + */ + +#define TSS_TSK 0 /* normal state in which dispatching is enabled during + task portion execution */ +#define TSS_DDSP 1 /* state after dis_dsp has been executed during task + portion execution (dispatch disabled) */ +#define TSS_LOC 3 /* state after loc_cpu has been executed during task + portion execution (interrupt and dispatch disabled) + */ +#define TSS_INDP 4 /* state during execution of task-independent portions + (interrupt and timer handlers) */ + +/* + * Reference Configuration (ref_cfg) Structure + */ + +typedef struct t_rcfg { + /* details concerning members are implementation dependent */ +} T_RCFG; + +/* + * Define Service (def_svc) Structure + */ + +typedef struct t_dsvc { + ATR svcatr; /* extended SVC handler attributes */ + FP svchdr; /* extended SVC handler address */ + /* additional information may be included depending on the implementation */ +} T_DSVC; + +/* + * Define Exception (def_exc) Structure + */ + +typedef struct t_dexc { + ATR excatr; /* exception handler attributes */ + FP exchdr; /* exception handler address */ + /* additional information may be included depending on the implementation */ +} T_DEXC; + +/* + * System Management Functions + */ + +/* + * get_ver - Get Version Information + */ + +ER get_ver( + T_VER *pk_ver +); + +/* + * ref_sys - Reference Semaphore Status + */ + +ER ref_sys( + T_RSYS *pk_rsys +); + +/* + * ref_cfg - Reference Configuration Information + */ + +ER ref_cfg( + T_RCFG *pk_rcfg +); + +/* + * def_svc - Define Extended SVC Handler + */ + +ER def_svc( + FN s_fncd, + T_DSVC *pk_dsvc +); + +/* + * def_exc - Define Exception Handler + */ + +ER def_exc( + UINT exckind, + T_DEXC *pk_dexc +); + + + + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/include/itronsys/task.h b/cpukit/itron/include/itronsys/task.h new file mode 100644 index 0000000000..fca48c03b8 --- /dev/null +++ b/cpukit/itron/include/itronsys/task.h @@ -0,0 +1,295 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_TASK_h_ +#define __ITRON_TASK_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Create Task (cre_tsk) Structure + */ + +typedef struct t_ctsk { + VP exinf; /* extended information */ + ATR tskatr; /* task attributes */ + FP task; /* task start address */ + PRI itskpri; /* initial task priority */ + INT stksz; /* stack size */ + /* additional information may be included depending on the implementation */ +} T_CTSK; + +/* + * Values for the tskatr field + */ + +#define TA_ASM 0x00 /* program written in assembly language */ +#define TA_HLNG 0x01 /* program written in high-level language */ +#define TA_COP0 0x8000 /* uses coprocessor having ID = 0 */ +#define TA_COP1 0x4000 /* uses coprocessor having ID = 1 */ +#define TA_COP2 0x2000 /* uses coprocessor having ID = 2 */ +#define TA_COP3 0x1000 /* uses coprocessor having ID = 3 */ +#define TA_COP4 0x0800 /* uses coprocessor having ID = 4 */ +#define TA_COP5 0x0400 /* uses coprocessor having ID = 5 */ +#define TA_COP6 0x0200 /* uses coprocessor having ID = 6 */ +#define TA_COP7 0x0100 /* uses coprocessor having ID = 7 */ + +/* + * Values for the tskid field + */ + +#define TSK_SELF 0 /* task specifies itself */ + +/* XXX is this a mistake in ITRON? FALSE was here and in the types list */ +#if 0 + +#define FALSE 0 /* indicates a task-independent portion (return */ + /* parameters only) */ +#endif + +/* + * Values for the tskpri field + */ + +#define TPRI_INI 0 /* specifies the initial priority on */ + /* task startup (chg_pri) */ +#define TPRI_RUN 0 /* specifies the highest priority during */ + /* execution (rot_rdq) */ + + +/* + * Reference Task (ref_tsk) Structure + */ + +typedef struct t_rtsk { + VP exinf; /* extended information */ + PRI tskpri; /* current priority */ + UINT tskstat; /* task state */ + /* + * The following are represent extended features of support + * [level X] (implementation-dependent). + */ + UINT tskwait; /* cause of wait */ + ID wid; /* ID of object being waited for */ + INT wupcnt; /* wakeup request count */ + INT suscnt; /* SUSPEND request count */ + ATR tskatr; /* task attributes */ + FP task; /* task start address */ + PRI itskpri; /* initial task priority */ + INT stksz; /* stack size */ +} T_RTSK; + +/* + * Values for the tskstat field + */ + + +#define TTS_RUN 0x01 /* RUN */ +#define TTS_RDY 0x02 /* READY */ +#define TTS_WAI 0x04 /* WAIT */ +#define TTS_SUS 0x08 /* SUSPEND */ +#define TTS_WAS 0x0C /* WAIT-SUSPEND */ +#define TTS_DMT 0x10 /* DORMANT */ + +/* + * Values for the tskwait field + */ + +#define TTW_SLP 0x0001 /* wait due to slp_tsk or tslp_tsk */ +#define TTW_DLY 0x0002 /* wait due to dly_tsk */ +#define TTW_NOD 0x0008 /* connection function response wait */ +#define TTW_FLG 0x0010 /* wait due to wai_flg or twai_flg */ +#define TTW_SEM 0x0020 /* wait due to wai_sem or twai_sem */ +#define TTW_MBX 0x0040 /* wait due to rcv_msg or trcv_msg */ +#define TTW_SMBF 0x0080 /* wait due to snd_mbf or tsnd_mbf */ +#define TTW_MBF 0x0100 /* wait due to rcv_mbf or trcv_mbf */ +#define TTW_CAL 0x0200 /* wait for rendezvous call */ +#define TTW_ACP 0x0400 /* wait for rendezvous accept */ +#define TTW_RDV 0x0800 /* wait for rendezvous completion */ +#define TTW_MPL 0x1000 /* wait due to get_blk or tget_blk */ +#define TTW_MPF 0x2000 /* wait due to get_blf or tget_blf */ + +/* + * Since the task states given by tskstat and tskwait are expressed + * by bit correspondences, they are convenient when looking for OR + * conditions (such as whether a task is in WAIT or READY state). + */ + +/* + * Task Management Functions + */ + +/* + * cre_tsk - Create Task + */ + +ER cre_tsk( + ID tskid, + T_CTSK *pk_ctsk +); + +/* + * del_tsk - Delete Task + */ + +ER del_tsk( + ID tskid +); + +/* + * sta_tsk - Start Task + */ + +ER sta_tsk( + ID tskid, + INT stacd +); + +/* + * ext_tsk - Exit Issuing Task + */ + +void ext_tsk( void ); + +/* + * exd_tsk - Exit and Delete Task + */ + +void exd_tsk( void ); + +/* + * ter_tsk - Terminate Other Task + */ + +ER ter_tsk( + ID tskid +); + +/* + * dis_dsp - Disable Dispatch + */ + +ER dis_dsp( void ); + +/* + * ena_dsp - Enable Dispatch + */ + +ER ena_dsp( void ); + +/* + * chg_pri - Change Task Priority + */ + +ER chg_pri( + ID tskid, + PRI tskpri +); + +/* + * rot_rdq - Rotate Tasks on the Ready Queue + */ + +ER rot_rdq( + PRI tskpri +); + +/* + * rel_wai - Release Wait of Other Task + */ + +ER rel_wai( + ID tskid +); + +/* + * get_tid - Get Task Identifier + */ + +ER get_tid( + ID *p_tskid +); + +/* + * ref_tsk - Reference Task Status + */ + +ER ref_tsk( + T_RTSK *pk_rtsk, + ID tskid +); + + +/* + * Task-Dependent Synchronization Functions + */ + +/* + * sus_tsk - Suspend Other Task + */ + +ER sus_tsk( + ID tskid +); + +/* + * rsm_tsk - Resume Suspended Task + */ + +ER rsm_tsk( + ID tskid +); + +/* + * frsm_tsk - Forcibly Resume Suspended Task + */ + +ER frsm_tsk( + ID tskid +); + +/* + * slp_tsk - Sleep Task Sleep Task with Timeout + */ + +ER slp_tsk( void ); + +/* + * tslp_tsk - Sleep Task with Timeout + */ + +ER tslp_tsk( + TMO tmout +); + +/* + * wup_tsk - Wakeup Other Task + */ + +ER wup_tsk( + ID tskid +); + +/* + * can_wup - Cancel Wakeup Request + */ + +ER can_wup( + INT *p_wupcnt, + ID tskid +); + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/include/itronsys/time.h b/cpukit/itron/include/itronsys/time.h new file mode 100644 index 0000000000..780c73b842 --- /dev/null +++ b/cpukit/itron/include/itronsys/time.h @@ -0,0 +1,182 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_TIME_h_ +#define __ITRON_TIME_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * System Time Data Type + * + * Member configuration depends on the bit width of the processor and + * on the implementation. A total of 48 bits is recommended. + * + */ + +typedef struct t_systime { + H utime; /* upper 16 bits */ + UW ltime; /* lower 32 bits */ +} SYSTIME, CYCTIME, ALMTIME; + +/* + * XXX Look this up in the spec and figure out where it comes + * XXX from. dly_tim() references it but it was left out + * XXX of the initial cut at the header files. + */ + +typedef int DLYTIME; + +/* + * XXX (def_cyc) Structure + */ + +typedef struct t_dcyc { + VP exinf; /* extended information */ + ATR cycatr; /* cyclic handler attributes */ + FP cychdr; /* cyclic handler address */ + UINT cycact; /* cyclic handler activation */ + CYCTIME cyctim; /* cyclic startup period */ +} T_DCYC; + +/* + * cycact + */ + +#define TCY_OFF 0x00 /* do not invoke cyclic handler */ +#define TCY_ON 0x01 /* invoke cyclic handler */ +#define TCY_INT 0x02 /* initialize cycle count */ + +/* + * Reference Cyclic Handler (ref_cyc) Structure + */ + +typedef struct t_rcyc { + VP exinf; /* extended information */ + CYCTIME lfttim; /* time left before next handler startup */ + UINT cycact; /* cyclic handler activation */ + /* additional information may be included depending on the implementation */ +} T_RCYC; + +/* + * Define Alarm (def_alm) Structure + */ + +typedef struct t_dalm { + VP exinf; /* extended information */ + ATR almatr; /* alarm handler attributes */ + FP almhdr; /* alarm handler address */ + UINT tmmode; /* start time specification mode */ + ALMTIME almtim; /* handler startup time */ +} T_DALM; + +/* + * tmmode + */ + +#define TTM_ABS 0x00 /* specified as an absolute time */ +#define TTM_REL 0x01 /* specified as a relative time */ + +/* + * Reference Alarm (ref_alm) Structure + */ + +typedef struct t_ralm { + VP exinf; /* extended information */ + ALMTIME lfttim; /* time left before next handler startup */ + /* additional information may be included depending on the implementation */ +} T_RALM; + +/* + * Time Management Functions + */ + +/* + * set_tim - Set System Clock + */ + +ER set_tim( + SYSTIME *pk_tim +); + +/* + * get_tim - Get System Clock + */ + +ER get_tim( + SYSTIME *pk_tim +); + +/* + * dly_tsk - Delay Task + */ + +ER dly_tsk( + DLYTIME dlytim +); + +/* + * def_cyc - Define Cyclic Handler + */ + +ER def_cyc( + HNO cycno, + T_DCYC *pk_dcyc +); + +/* + * act_cyc - Activate Cyclic Handler + */ + +ER act_cyc( + HNO cycno, + UINT cycact +); + +/* + * ref_cyc - Reference Cyclic Handler Status + */ + +ER ref_cyc( + T_RCYC *pk_rcyc, + HNO cycno +); + +/* + * def_alm - Define Alarm Handler + */ + +ER def_alm( + HNO almno, + T_DALM *pk_dalm +); + +/* + * ref_alm - Reference Alarm Handler Status + */ + +ER ref_alm( + T_RALM *pk_ralm, + HNO almno +); + +/* + * ret_tmr - Return from Timer Handler + */ + +void ret_tmr( void ); + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/include/itronsys/types.h b/cpukit/itron/include/itronsys/types.h new file mode 100644 index 0000000000..fd045df6aa --- /dev/null +++ b/cpukit/itron/include/itronsys/types.h @@ -0,0 +1,114 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_TYPES_h_ +#define __ITRON_TYPES_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* XXX some of these may need to be moved */ + +typedef signed8 B; /* signed 8-bit integer */ +typedef signed16 H; /* signed 16-bit integer */ +typedef signed32 W; /* signed 32-bit integer */ +typedef unsigned8 UB; /* unsigned 8-bit integer */ +typedef unsigned16 UH; /* unsigned 16-bit integer */ +typedef unsigned32 UW; /* unsigned 32-bit integer */ + +typedef unsigned32 VW; /* unpredictable data type (32-bit size) */ +typedef unsigned16 VH; /* unpredictable data type (16-bit size) */ +typedef unsigned8 VB; /* unpredictable data type (8-bit size) */ + +typedef void *VP; /* pointer to an unpredictable data type */ + +typedef void (*FP)(); /* program start address */ + +/* + * 6.4 Data Types + * + * The difference between VB, VH and VW and B, H and W is that only the + * number of bits is known for the former, not the data type of the + * contents. The latter clearly represent integers. + */ + +/* + * Data Types Dependent on ITRON Specification + * + * In order to clarify the meanings of certain parameters, the + * following names are used for data types which appear frequently + * and/or have special meanings. + */ + +typedef signed32 INT; /* Signed integer (bit width of processor) */ +typedef unsigned32 UINT; /* Unsigned integer (bit width of processor) */ +typedef boolean BOOL; /* Boolean value. TRUE (1) or FALSE (0). */ +typedef signed16 FN; /* Function code. Signed integer. Maximum 2 bytes. */ +typedef int ID; /* Object ID number (???id) */ + /* Value range depends on the system. Usually */ + /* a signed integer. Certain ID values may */ + /* represent objects on other nodes when the */ + /* connection function is supported. */ + +typedef unsigned32 BOOL_ID;/* Boolean value or ID number */ + +typedef signed32 HNO; /* Handler number */ +typedef signed32 RNO; /* Rendezvous number */ +typedef signed32 NODE; /* Node Number. Usually a signed integer. */ +typedef signed32 ATR; /* Object or handler attribute. */ + /* An unsigned integer. */ +typedef signed32 ER; /* Error code. A signed integer. */ +typedef unsigned32 PRI; /* Task priority. A signed integer. */ +typedef signed32 TMO; /* Timeout value. A signed integer. */ + /* TMO_POL = 0 indicates polling, */ + /* while TMO_FEVR = -1 indicates wait forever. */ + +/* + * 6.6 Common Constants and Data Structure Packet Formats + */ + +#define NADR (-1) /* invalid address or pointer value */ + +#ifndef TRUE +#define TRUE 1 /* true */ +#endif + +#ifndef FALSE +#define FALSE 0 /* false */ +#endif + +/* + * ATR tskatr, intatr, cycatr, almatr, svcatr, excatr: + * + * TA_ASM indicates that the task or handler is directly started + * at the assembly language level. The TA_ASM attribute has the + * opposite meaning of TA_HLNG. + * + * NOTE: Really in + */ + +#if 0 +#define TA_ASM 0x00 /* program written in assembly language */ +#define TA_HLNG 0x01 /* program written in high-level language */ +#endif + +/* + * TMO tmout: + */ + +#define TMO_POL 0 /* polling */ +#define TMO_FEVR (-1) /* wait forever */ + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/include/itronsys/vmempool.h b/cpukit/itron/include/itronsys/vmempool.h new file mode 100644 index 0000000000..7ef45398d3 --- /dev/null +++ b/cpukit/itron/include/itronsys/vmempool.h @@ -0,0 +1,129 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_VARIABLE_MEMORYPOOL_h_ +#define __ITRON_VARIABLE_MEMORYPOOL_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Create Variable Memory Pool (cre_mpl) Structure + */ + +typedef struct t_cmpl { + VP exinf; /* extended information */ + ATR mplatr; /* memorypool attributes */ + INT mplsz; /* memorypool size */ + /* additional information may be included depending on the implementation */ +} T_CMPL; + +/* + * mplatr + */ + +#define TA_TFIFO 0x00 /* waiting tasks are handled by FIFO */ +#define TA_TPRI 0x01 /* waiting tasks are handled by priority */ + +/* + * mplid + */ + +#define TMPL_OS (-4) /* memorypool used by OS */ + +/* + * Reference Variable Memory Pool (ref_mpl) Structure + */ + +typedef struct t_rmpl { + VP exinf; /* extended information */ + BOOL_ID wtsk; /* indicates whether or not there are waiting tasks */ + INT frsz; /* total size of free memory */ + INT maxsz; /* size of largest contiguous memory */ + /* additional information may be included depending on the implementation */ +} T_RMPL; + +/* + * Variable Memory Pool Functions + */ + +/* + * cre_mpl - Create Variable-Size Memorypool + */ + +ER cre_mpl( + ID mplid, + T_CMPL *pk_cmpl +); + +/* + * del_mpl - Delete Variable-Size Memorypool + */ + +ER del_mpl( + ID mplid +); + +/* + * get_blk - Get Variable-Size Memory Block + */ + +ER get_blk( + VP *p_blk, + ID mplid, + INT blksz +); + +/* + * pget_blk - Poll and Get Variable-Size Memory Block + */ + +ER pget_blk( + VP *p_blk, + ID mplid, + INT blksz +); + +/* + * tget_blk - Get Variable-Size Memory Block with Timeout + */ + +ER tget_blk( + VP *p_blk, + ID mplid, + INT blksz, + TMO tmout +); + +/* + * rel_blk - Release Variable-Size Memory Block + */ + +ER rel_blk( + ID mplid, + VP blk +); + +/* + * ref_mpl - Reference Variable-Size Memorypool Status + */ + +ER ref_mpl( + T_RMPL *pk_rmpl, + ID mplid +); + + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/include/rtems/itron/README b/cpukit/itron/include/rtems/itron/README new file mode 100644 index 0000000000..9ac3bf3417 --- /dev/null +++ b/cpukit/itron/include/rtems/itron/README @@ -0,0 +1,10 @@ +# +# $Id$ +# + +This directory contains the private interface of each manager. +These files should only be included from the from the +implementation of each manager. + +The public header file for each ITRON manager is in +../../../tronsys. \ No newline at end of file diff --git a/cpukit/itron/include/rtems/itron/config.h b/cpukit/itron/include/rtems/itron/config.h new file mode 100644 index 0000000000..8403832025 --- /dev/null +++ b/cpukit/itron/include/rtems/itron/config.h @@ -0,0 +1,63 @@ +/* config.h + * + * This include file contains the table of user defined configuration + * parameters specific for the ITRON API. + * + * COPYRIGHT (c) 1989-1998. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __RTEMS_ITRON_CONFIGURATION_h +#define __RTEMS_ITRON_CONFIGURATION_h + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * XXX + * + * 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: + * + * + required number of each object type + */ + +/* + * For now, we are only allowing the user to specify the entry point + * and stack size for ITRON initialization threads. + */ + +typedef struct { + ID id; + T_CTSK attributes; +} itron_initialization_tasks_table; + +typedef struct { + int maximum_tasks; + int maximum_semaphores; + int maximum_eventflags; + int maximum_mailboxes; + int maximum_message_buffers; + int maximum_ports; + int maximum_memory_pools; + int maximum_fixed_memory_pools; + int number_of_initialization_tasks; + itron_initialization_tasks_table *User_initialization_tasks_table; +} itron_api_configuration_table; + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ diff --git a/cpukit/itron/include/rtems/itron/eventflags.h b/cpukit/itron/include/rtems/itron/eventflags.h new file mode 100644 index 0000000000..3bd2903aaa --- /dev/null +++ b/cpukit/itron/include/rtems/itron/eventflags.h @@ -0,0 +1,58 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __RTEMS_ITRON_EVENTFLAGS_h_ +#define __RTEMS_ITRON_EVENTFLAGS_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * The following defines the control block used to manage each event flag. + */ + +typedef struct { + ITRON_Objects_Control Object; + unsigned32 XXX_more_stuff_goes_here; +} ITRON_Eventflags_Control; + +/* + * The following defines the information control block used to manage + * this class of objects. + */ + +ITRON_EXTERN Objects_Information _ITRON_Eventflags_Information; + +/* + * _ITRON_Eventflags_Manager_initialization + * + * DESCRIPTION: + * + * This routine performs the initialization necessary for this manager. + */ + +void _ITRON_Eventflags_Manager_initialization( + unsigned32 maximum_eventflags +); + +/* + * XXX insert private stuff here + */ + +#include + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/include/rtems/itron/fmempool.h b/cpukit/itron/include/rtems/itron/fmempool.h new file mode 100644 index 0000000000..5ee17fd6b0 --- /dev/null +++ b/cpukit/itron/include/rtems/itron/fmempool.h @@ -0,0 +1,59 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __RTEMS_ITRON_FIXED_MEMORYPOOL_h_ +#define __RTEMS_ITRON_FIXED_MEMORYPOOL_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * The following defines the control block used to manage each + * fixed memory pool. + */ + +typedef struct { + ITRON_Objects_Control Object; + unsigned32 XXX_more_stuff_goes_here; +} ITRON_Fixed_memory_pool_Control; + +/* + * The following defines the information control block used to manage + * this class of objects. + */ + +ITRON_EXTERN Objects_Information _ITRON_Fixed_memory_pool_Information; + +/* + * _ITRON_Fixed_memory_pool_Manager_initialization + * + * DESCRIPTION: + * + * This routine performs the initialization necessary for this manager. + */ + +void _ITRON_Fixed_memory_pool_Manager_initialization( + unsigned32 maximum_fixed_memory_pools +); + +/* + * XXX insert private stuff here + */ + +#include + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/include/rtems/itron/intr.h b/cpukit/itron/include/rtems/itron/intr.h new file mode 100644 index 0000000000..d6d2703462 --- /dev/null +++ b/cpukit/itron/include/rtems/itron/intr.h @@ -0,0 +1,28 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __RTEMS_ITRON_INTERRUPT_h_ +#define __RTEMS_ITRON_INTERRUPT_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * XXX insert private stuff here + */ + +#include + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/include/rtems/itron/itronapi.h b/cpukit/itron/include/rtems/itron/itronapi.h new file mode 100644 index 0000000000..b66f5fa379 --- /dev/null +++ b/cpukit/itron/include/rtems/itron/itronapi.h @@ -0,0 +1,27 @@ +/* + * ITRON API Support + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_API_h +#define __ITRON_API_h + +#include + +/* + * _ITRON_API_Initialize + * + * Initialize the ITRON API. + */ + +void _ITRON_API_Initialize( + rtems_configuration_table *configuration_table +); + +#endif +/* end of include file */ diff --git a/cpukit/itron/include/rtems/itron/mbox.h b/cpukit/itron/include/rtems/itron/mbox.h new file mode 100644 index 0000000000..5ce4180643 --- /dev/null +++ b/cpukit/itron/include/rtems/itron/mbox.h @@ -0,0 +1,58 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __RTEMS_ITRON_MBOX_h_ +#define __RTEMS_ITRON_MBOX_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * The following defines the control block used to manage each mailbox. + */ + +typedef struct { + ITRON_Objects_Control Object; + unsigned32 XXX_more_stuff_goes_here; +} ITRON_Mailbox_Control; + +/* + * The following defines the information control block used to manage + * this class of objects. + */ + +ITRON_EXTERN Objects_Information _ITRON_Mailbox_Information; + +/* + * _ITRON_Mailbox_Manager_initialization + * + * DESCRIPTION: + * + * This routine performs the initialization necessary for this manager. + */ + +void _ITRON_Mailbox_Manager_initialization( + unsigned32 maximum_mailboxes +); + +/* + * XXX insert private stuff here + */ + +#include + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/include/rtems/itron/msgbuffer.h b/cpukit/itron/include/rtems/itron/msgbuffer.h new file mode 100644 index 0000000000..bc559b5a65 --- /dev/null +++ b/cpukit/itron/include/rtems/itron/msgbuffer.h @@ -0,0 +1,60 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __RTEMS_ITRON_MESSAGEBUFFER_h_ +#define __RTEMS_ITRON_MESSAGEBUFFER_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/* + * The following defines the control block used to manage each + * message buffer. + */ + +typedef struct { + ITRON_Objects_Control Object; + boolean is_priority_blocking; + CORE_message_queue_Control message_queue; +} ITRON_Message_buffer_Control; + +/* + * The following defines the information control block used to manage + * this class of objects. + */ + +ITRON_EXTERN Objects_Information _ITRON_Message_buffer_Information; + +/* + * _ITRON_Message_buffer_Manager_initialization + * + * DESCRIPTION: + * + * This routine performs the initialization necessary for this manager. + */ + +void _ITRON_Message_buffer_Manager_initialization( + unsigned32 maximum_message_buffers +); + +/* + * XXX insert private stuff here + */ + +#include + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ diff --git a/cpukit/itron/include/rtems/itron/network.h b/cpukit/itron/include/rtems/itron/network.h new file mode 100644 index 0000000000..23e1d2f7bf --- /dev/null +++ b/cpukit/itron/include/rtems/itron/network.h @@ -0,0 +1,28 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __RTEMS_ITRON_NETWORK_h_ +#define __RTEMS_ITRON_NETWORK_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * XXX insert private stuff here + */ + +#include + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/include/rtems/itron/object.h b/cpukit/itron/include/rtems/itron/object.h new file mode 100644 index 0000000000..71bc9ed6d1 --- /dev/null +++ b/cpukit/itron/include/rtems/itron/object.h @@ -0,0 +1,117 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __RTEMS_ITRON_OBJECT_h_ +#define __RTEMS_ITRON_OBJECT_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +typedef Objects_Control ITRON_Objects_Control; + +/* + * Maximum length of an ITRON object name + * + * NOTE: Since ITRON objects do not have names, then then length is 0. + */ + +#define ITRON_MAXIMUM_NAME_LENGTH 0 + +/* + * _ITRON_Objects_Open + * + * Make this ITRON object visible to the system. + * + * NOTE: This macro hides the fact that ITRON objects don't have names. + */ + +#define _ITRON_Objects_Open( _the_information, _the_object ) \ + _Objects_Open( (_the_information), (_the_object), 0 ) + +/* + * _ITRON_Objects_Close + * + * Make this ITRON object invisible from the system. Usually used as + * the first step of deleting an object. + */ + +#define _ITRON_Objects_Close( _the_information, _the_object ) \ + _Objects_Close( (_the_information), (_the_object) ) + +/* + * _ITRON_Objects_Allocate_by_index + * + * Allocate the ITRON object specified by "_id". The ITRON id is the + * index portion of the traditional RTEMS ID. The Classic and POSIX + * APIs do not require that a specific object be allocated. + */ + +#define _ITRON_Objects_Allocate_by_index( _the_information, _id, _sizeof ) \ + _Objects_Allocate_by_index( (_the_information), (_id), (_sizeof) ) + +/* + * _ITRON_Objects_Clarify_allocation_id_error + * + * This function is invoked when an object allocation ID error + * occurs to determine the specific ITRON error code to return. + */ + +#define _ITRON_Objects_Clarify_allocation_id_error( _the_information, _id ) \ + (((_id) < -4) ? E_OACV : /* attempt to access a "system object" */ \ + ((_id) <= 0) ? E_ID : /* bogus index of 0 - -3 */ \ + ((_id) <= (_the_information)->maximum) ? E_OBJ : /* object is in use */ \ + E_ID) /* simply a bad id */ + +/* + * _ITRON_Objects_Clarify_get_id_error + * + * This function is invoked when an object get ID error + * occurs to determine the specific ITRON error code to return. + */ + +#define _ITRON_Objects_Clarify_get_id_error( _the_information, _id ) \ + (((_id) < -4) ? E_OACV : /* attempt to access a "system object" */ \ + ((_id) <= 0) ? E_ID : /* bogus index of 0 - -3 */ \ + ((_id) <= (_the_information)->maximum) ? E_OBJ : /* object is in use */ \ + E_ID) /* simply a bad id */ + + +/* + * _ITRON_Objects_Free + * + * Free this ITRON object to the pool of inactive objects. This + * operation is the same as for the Classic and POSIX APIs. + */ + +#define _ITRON_Objects_Free( _the_information, _the_object ) \ + _Objects_Free( (_the_information), (_the_object) ) + + +/* + * _ITRON_Objects_Get + * + * Obtain (get) the pointer to the control block for the object + * specified by "id". The ITRON id passed in here is simply + * the "index" portion of the traditional RTEMS ID. This + * requires that this operation be slightly different + * from the object get used by the Classic and POSIX APIs. + */ + +#define _ITRON_Objects_Get( _the_information, _id, _the_object ) \ + _Objects_Get( (_the_information), (_id), (_the_object) ) + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/include/rtems/itron/port.h b/cpukit/itron/include/rtems/itron/port.h new file mode 100644 index 0000000000..cfa71c8651 --- /dev/null +++ b/cpukit/itron/include/rtems/itron/port.h @@ -0,0 +1,58 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __RTEMS_ITRON_PORT_h_ +#define __RTEMS_ITRON_PORT_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * The following defines the control block used to manage each port. + */ + +typedef struct { + ITRON_Objects_Control Object; + unsigned32 XXX_more_stuff_goes_here; +} ITRON_Port_Control; + +/* + * The following defines the information control block used to manage + * this class of objects. + */ + +ITRON_EXTERN Objects_Information _ITRON_Port_Information; + +/* + * _ITRON_Port_Manager_initialization + * + * DESCRIPTION: + * + * This routine performs the initialization necessary for this manager. + */ + +void _ITRON_Port_Manager_initialization( + unsigned32 maximum_ports +); + +/* + * XXX insert private stuff here + */ + +#include + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/include/rtems/itron/semaphore.h b/cpukit/itron/include/rtems/itron/semaphore.h new file mode 100644 index 0000000000..8bfd1d783a --- /dev/null +++ b/cpukit/itron/include/rtems/itron/semaphore.h @@ -0,0 +1,56 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __RTEMS_ITRON_SEMAPHORE_h_ +#define __RTEMS_ITRON_SEMAPHORE_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/* + * The following defines the control block used to manage each semaphore. + */ + +typedef struct { + ITRON_Objects_Control Object; + boolean is_priority_blocking; + CORE_semaphore_Control semaphore; +} ITRON_Semaphore_Control; + +/* + * The following defines the information control block used to manage + * this class of objects. + */ + +ITRON_EXTERN Objects_Information _ITRON_Semaphore_Information; + +/* + * _ITRON_Semaphore_Manager_initialization + * + * DESCRIPTION: + * + * This routine performs the initialization necessary for this manager. + */ + +void _ITRON_Semaphore_Manager_initialization( + unsigned32 maximum_semaphores +); + +#include + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/include/rtems/itron/sysmgmt.h b/cpukit/itron/include/rtems/itron/sysmgmt.h new file mode 100644 index 0000000000..92b6cf72db --- /dev/null +++ b/cpukit/itron/include/rtems/itron/sysmgmt.h @@ -0,0 +1,28 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __RTEMS_ITRON_TIME_h_ +#define __RTEMS_ITRON_TIME_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * XXX insert private stuff here + */ + +#include + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/include/rtems/itron/task.h b/cpukit/itron/include/rtems/itron/task.h new file mode 100644 index 0000000000..fffcc16d82 --- /dev/null +++ b/cpukit/itron/include/rtems/itron/task.h @@ -0,0 +1,88 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __RTEMS_ITRON_TASK_h_ +#define __RTEMS_ITRON_TASK_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +/* + * This macro evaluates to TRUE if there should be a "context error." + * This is defined as a blocking directive being issed from + * task-independent portions or a task in dispatch disabled state. + * + * NOTE: Dispatching is disabled in interrupts so this should cover + * both cases. + */ + +#define _ITRON_Is_in_non_task_state() \ + (_Thread_Dispatch_disable_level != 0) + +/* + * This is the API specific information required by each thread for + * the ITRON API to function correctly. + */ + + +typedef struct { + unsigned32 unused; /* no use for the API extension */ + /* structure for ITRON identified yet */ +} ITRON_API_Control; + +/* + * The following defines the information control block used to + * manage this class of objects. + */ + +ITRON_EXTERN Objects_Information _ITRON_Task_Information; + +/* + * These are used to manage the user initialization tasks. + */ + +ITRON_EXTERN itron_initialization_tasks_table + *_ITRON_Task_User_initialization_tasks; +ITRON_EXTERN unsigned32 _ITRON_Task_Number_of_initialization_tasks; + + +/* + * _ITRON_Task_Manager_initialization + * + * This routine initializes the ITRON Task Manager. + */ + +void _ITRON_Task_Manager_initialization( + unsigned32 maximum_tasks, + unsigned32 number_of_initialization_tasks, + itron_initialization_tasks_table *user_tasks +); + +/* + * + * _ITRON_Delete_task + */ + +ER _ITRON_Delete_task( + Thread_Control *the_thread +); + +#include + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/include/rtems/itron/time.h b/cpukit/itron/include/rtems/itron/time.h new file mode 100644 index 0000000000..0cc2d20101 --- /dev/null +++ b/cpukit/itron/include/rtems/itron/time.h @@ -0,0 +1,28 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __RTEMS_ITRON_TIME_h_ +#define __RTEMS_ITRON_TIME_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * XXX insert private stuff here + */ + +#include + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/include/rtems/itron/vmempool.h b/cpukit/itron/include/rtems/itron/vmempool.h new file mode 100644 index 0000000000..63bf3310f9 --- /dev/null +++ b/cpukit/itron/include/rtems/itron/vmempool.h @@ -0,0 +1,59 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __RTEMS_ITRON_VARIABLE_MEMORYPOOL_h_ +#define __RTEMS_ITRON_VARIABLE_MEMORYPOOL_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* + * The following defines the control block used to manage each variable + * memory pool. + */ + +typedef struct { + ITRON_Objects_Control Object; + unsigned32 XXX_more_stuff_goes_here; +} ITRON_Variable_memory_pool_Control; + +/* + * The following defines the information control block used to manage + * this class of objects. + */ + +ITRON_EXTERN Objects_Information _ITRON_Variable_memory_pool_Information; + +/* + * _ITRON_Variable_memory_pool_Manager_initialization + * + * DESCRIPTION: + * + * This routine performs the initialization necessary for this manager. + */ + +void _ITRON_Variable_memory_pool_Manager_initialization( + unsigned32 maximum_variable_memory_pools +); + +/* + * XXX insert private stuff here + */ + +#include + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/inline/Makefile.am b/cpukit/itron/inline/Makefile.am new file mode 100644 index 0000000000..32269fcdcd --- /dev/null +++ b/cpukit/itron/inline/Makefile.am @@ -0,0 +1,10 @@ +## +## $Id$ +## + +AUTOMAKE_OPTIONS = foreign 1.4 + +SUBDIRS = rtems + +include $(top_srcdir)/../../../../automake/subdirs.am +include $(top_srcdir)/../../../../automake/local.am diff --git a/cpukit/itron/inline/rtems/itron/eventflags.inl b/cpukit/itron/inline/rtems/itron/eventflags.inl new file mode 100644 index 0000000000..af6665915c --- /dev/null +++ b/cpukit/itron/inline/rtems/itron/eventflags.inl @@ -0,0 +1,148 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_EVENTFLAGS_inl_ +#define __ITRON_EVENTFLAGS_inl_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * _ITRON_Eventflags_Allocate + * + * DESCRIPTION: + * + * This routine allocates the eventflags associated with the specified + * eventflags ID from the pool of inactive eventflagss. + * + * Input parameters: + * flgid - id of eventflags to allocate + * status - pointer to status variable + * + * Output parameters: + * returns - pointer to the eventflags control block + * *status - status + */ + +RTEMS_INLINE_ROUTINE ITRON_Eventflags_Control *_ITRON_Eventflags_Allocate( + ID flgid +) +{ + return (ITRON_Eventflags_Control *)_ITRON_Objects_Allocate_by_index( + &_ITRON_Eventflags_Information, + flgid, + sizeof(ITRON_Eventflags_Control) + ); +} + +/* + * _ITRON_Eventflags_Clarify_allocation_id_error + * + * This function is invoked when an object allocation ID error + * occurs to determine the specific ITRON error code to return. + */ + +#define _ITRON_Eventflags_Clarify_allocation_id_error( _id ) \ + _ITRON_Objects_Clarify_allocation_id_error( \ + &_ITRON_Eventflags_Information, (_id) ) + +/* + * _ITRON_Eventflags_Clarify_get_id_error + * + * This function is invoked when an object get ID error + * occurs to determine the specific ITRON error code to return. + */ + +#define _ITRON_Eventflags_Clarify_get_id_error( _id ) \ + _ITRON_Objects_Clarify_get_id_error( &_ITRON_Eventflags_Information, (_id) ) + +/* + * _ITRON_Eventflags_Free + * + * DESCRIPTION: + * + * This routine frees a eventflags control block to the + * inactive chain of free eventflags control blocks. + * + * Input parameters: + * the_eventflags - pointer to eventflags control block + * + * Output parameters: NONE + */ + +RTEMS_INLINE_ROUTINE void _ITRON_Eventflags_Free ( + ITRON_Eventflags_Control *the_eventflags +) +{ + _ITRON_Objects_Free( &_ITRON_Eventflags_Information, &the_eventflags->Object ); +} + +/*PAGE + * + * _ITRON_Eventflags_Get + * + * DESCRIPTION: + * + * This function maps eventflags IDs to eventflags control blocks. + * If ID corresponds to a local eventflags, then it returns + * the_eventflags control pointer which maps to ID and location + * is set to OBJECTS_LOCAL. if the eventflags ID is global and + * resides on a remote node, then location is set to OBJECTS_REMOTE, + * and the_eventflags is undefined. Otherwise, location is set + * to OBJECTS_ERROR and the_eventflags is undefined. + * + * Input parameters: + * id - ITRON eventflags ID. + * the_location - pointer to a location variable + * + * Output parameters: + * *the_location - location of the object + */ + +RTEMS_INLINE_ROUTINE ITRON_Eventflags_Control *_ITRON_Eventflags_Get ( + ID id, + Objects_Locations *location +) +{ + return (ITRON_Eventflags_Control *) + _ITRON_Objects_Get( &_ITRON_Eventflags_Information, id, location ); +} + +/*PAGE + * + * _ITRON_Eventflags_Is_null + * + * This function returns TRUE if the_eventflags is NULL and FALSE otherwise. + * + * Input parameters: + * the_eventflags - pointer to eventflags control block + * + * Output parameters: + * TRUE - if the_eventflags is NULL + * FALSE - otherwise + */ + +RTEMS_INLINE_ROUTINE boolean _ITRON_Eventflags_Is_null ( + ITRON_Eventflags_Control *the_eventflags +) +{ + return ( the_eventflags == NULL ); +} + +/* + * XXX insert inline routines here + */ + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/inline/rtems/itron/fmempool.inl b/cpukit/itron/inline/rtems/itron/fmempool.inl new file mode 100644 index 0000000000..38056b6671 --- /dev/null +++ b/cpukit/itron/inline/rtems/itron/fmempool.inl @@ -0,0 +1,155 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_FIXED_MEMORY_POOL_inl_ +#define __ITRON_FIXED_MEMORY_POOL_inl_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * _ITRON_Fixed_memory_pool_Allocate + * + * DESCRIPTION: + * + * This routine allocates the fixed_memory_pool associated with the specified + * fixed_memory_pool ID from the pool of inactive fixed_memory_pools. + * + * Input parameters: + * mpfid - id of fixed_memory_pool to allocate + * status - pointer to status variable + * + * Output parameters: + * returns - pointer to the fixed_memory_pool control block + * *status - status + */ + +RTEMS_INLINE_ROUTINE ITRON_Fixed_memory_pool_Control + *_ITRON_Fixed_memory_pool_Allocate( + ID mpfid +) +{ + return (ITRON_Fixed_memory_pool_Control *)_ITRON_Objects_Allocate_by_index( + &_ITRON_Fixed_memory_pool_Information, + mpfid, + sizeof(ITRON_Fixed_memory_pool_Control) + ); +} + +/* + * _ITRON_Fixed_memory_pool_Clarify_allocation_id_error + * + * This function is invoked when an object allocation ID error + * occurs to determine the specific ITRON error code to return. + */ + +#define _ITRON_Fixed_memory_pool_Clarify_allocation_id_error( _id ) \ + _ITRON_Objects_Clarify_allocation_id_error( \ + &_ITRON_Fixed_memory_pool_Information, (_id) ) + +/* + * _ITRON_Fixed_memory_pool_Clarify_get_id_error + * + * This function is invoked when an object get ID error + * occurs to determine the specific ITRON error code to return. + */ + +#define _ITRON_Fixed_memory_pool_Clarify_get_id_error( _id ) \ + _ITRON_Objects_Clarify_get_id_error( \ + &_ITRON_Fixed_memory_pool_Information, (_id) ) + +/* + * _ITRON_Fixed_memory_pool_Free + * + * DESCRIPTION: + * + * This routine frees a fixed_memory_pool control block to the + * inactive chain of free fixed_memory_pool control blocks. + * + * Input parameters: + * the_fixed_memory_pool - pointer to fixed_memory_pool control block + * + * Output parameters: NONE + */ + +RTEMS_INLINE_ROUTINE void _ITRON_Fixed_memory_pool_Free ( + ITRON_Fixed_memory_pool_Control *the_fixed_memory_pool +) +{ + _ITRON_Objects_Free( + &_ITRON_Fixed_memory_pool_Information, + &the_fixed_memory_pool->Object + ); +} + +/*PAGE + * + * _ITRON_Fixed_memory_pool_Get + * + * DESCRIPTION: + * + * This function maps fixed memory pool IDs to control blocks. + * If ID corresponds to a local fixed memory pool, then it returns + * the_fixed memory pool control pointer which maps to ID and location + * is set to OBJECTS_LOCAL. if the fixed memory pool ID is global and + * resides on a remote node, then location is set to OBJECTS_REMOTE, + * and the fixed memory pool is undefined. Otherwise, location is set + * to OBJECTS_ERROR and the fixed memory pool is undefined. + * + * Input parameters: + * id - ITRON fixed memory pool ID. + * the_location - pointer to a location variable + * + * Output parameters: + * *the_location - location of the object + */ + +RTEMS_INLINE_ROUTINE ITRON_Fixed_memory_pool_Control + *_ITRON_Fixed_memory_pool_Get ( + ID id, + Objects_Locations *location +) +{ + return (ITRON_Fixed_memory_pool_Control *) + _ITRON_Objects_Get( &_ITRON_Fixed_memory_pool_Information, id, location ); +} + +/*PAGE + * + * _ITRON_Fixed_memory_pool_Is_null + * + * This function returns TRUE if the_fixed_memory_pool is NULL + * and FALSE otherwise. + * + * Input parameters: + * the_fixed_memory_pool - pointer to fixed_memory_pool control block + * + * Output parameters: + * TRUE - if the_fixed_memory_pool is NULL + * FALSE - otherwise + */ + +RTEMS_INLINE_ROUTINE boolean _ITRON_Fixed_memory_pool_Is_null ( + ITRON_Fixed_memory_pool_Control *the_fixed_memory_pool +) +{ + return ( the_fixed_memory_pool == NULL ); +} + +/* + * XXX insert inline routines here + */ + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/inline/rtems/itron/intr.inl b/cpukit/itron/inline/rtems/itron/intr.inl new file mode 100644 index 0000000000..a991e03365 --- /dev/null +++ b/cpukit/itron/inline/rtems/itron/intr.inl @@ -0,0 +1,27 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_INTERRUPT_inl_ +#define __ITRON_INTERRUPT_inl_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * XXX insert inline routines here + */ + + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/inline/rtems/itron/mbox.inl b/cpukit/itron/inline/rtems/itron/mbox.inl new file mode 100644 index 0000000000..d6666d6435 --- /dev/null +++ b/cpukit/itron/inline/rtems/itron/mbox.inl @@ -0,0 +1,148 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_MAILBOX_inl_ +#define __ITRON_MAILBOX_inl_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * _ITRON_Mailbox_Allocate + * + * DESCRIPTION: + * + * This routine allocates the mailbox associated with the specified + * mailbox ID from the pool of inactive mailboxs. + * + * Input parameters: + * mbxid - id of mailbox to allocate + * status - pointer to status variable + * + * Output parameters: + * returns - pointer to the mailbox control block + * *status - status + */ + +RTEMS_INLINE_ROUTINE ITRON_Mailbox_Control *_ITRON_Mailbox_Allocate( + ID mbxid +) +{ + return (ITRON_Mailbox_Control *)_ITRON_Objects_Allocate_by_index( + &_ITRON_Mailbox_Information, + mbxid, + sizeof(ITRON_Mailbox_Control) + ); +} + +/* + * _ITRON_Mailbox_Clarify_allocation_id_error + * + * This function is invoked when an object allocation ID error + * occurs to determine the specific ITRON error code to return. + */ + +#define _ITRON_Mailbox_Clarify_allocation_id_error( _id ) \ + _ITRON_Objects_Clarify_allocation_id_error( \ + &_ITRON_Mailbox_Information, (_id) ) + +/* + * _ITRON_Mailbox_Clarify_get_id_error + * + * This function is invoked when an object get ID error + * occurs to determine the specific ITRON error code to return. + */ + +#define _ITRON_Mailbox_Clarify_get_id_error( _id ) \ + _ITRON_Objects_Clarify_get_id_error( &_ITRON_Mailbox_Information, (_id) ) + +/* + * _ITRON_Mailbox_Free + * + * DESCRIPTION: + * + * This routine frees a mailbox control block to the + * inactive chain of free mailbox control blocks. + * + * Input parameters: + * the_mailbox - pointer to mailbox control block + * + * Output parameters: NONE + */ + +RTEMS_INLINE_ROUTINE void _ITRON_Mailbox_Free ( + ITRON_Mailbox_Control *the_mailbox +) +{ + _ITRON_Objects_Free( &_ITRON_Mailbox_Information, &the_mailbox->Object ); +} + +/*PAGE + * + * _ITRON_Mailbox_Get + * + * DESCRIPTION: + * + * This function maps mailbox IDs to mailbox control blocks. + * If ID corresponds to a local mailbox, then it returns + * the_mailbox control pointer which maps to ID and location + * is set to OBJECTS_LOCAL. if the mailbox ID is global and + * resides on a remote node, then location is set to OBJECTS_REMOTE, + * and the_mailbox is undefined. Otherwise, location is set + * to OBJECTS_ERROR and the_mailbox is undefined. + * + * Input parameters: + * id - ITRON mailbox ID. + * the_location - pointer to a location variable + * + * Output parameters: + * *the_location - location of the object + */ + +RTEMS_INLINE_ROUTINE ITRON_Mailbox_Control *_ITRON_Mailbox_Get ( + ID id, + Objects_Locations *location +) +{ + return (ITRON_Mailbox_Control *) + _ITRON_Objects_Get( &_ITRON_Mailbox_Information, id, location ); +} + +/*PAGE + * + * _ITRON_Mailbox_Is_null + * + * This function returns TRUE if the_mailbox is NULL and FALSE otherwise. + * + * Input parameters: + * the_mailbox - pointer to mailbox control block + * + * Output parameters: + * TRUE - if the_mailbox is NULL + * FALSE - otherwise + */ + +RTEMS_INLINE_ROUTINE boolean _ITRON_Mailbox_Is_null ( + ITRON_Mailbox_Control *the_mailbox +) +{ + return ( the_mailbox == NULL ); +} + +/* + * XXX insert inline routines here + */ + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/inline/rtems/itron/msgbuffer.inl b/cpukit/itron/inline/rtems/itron/msgbuffer.inl new file mode 100644 index 0000000000..fcdca8edf7 --- /dev/null +++ b/cpukit/itron/inline/rtems/itron/msgbuffer.inl @@ -0,0 +1,153 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_MESSAGE_BUFFER_inl_ +#define __ITRON_MESSAGE_BUFFER_inl_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * _ITRON_Message_buffer_Allocate + * + * DESCRIPTION: + * + * This routine allocates the message buffer associated with the specified + * message buffer ID from the pool of inactive message buffers. + * + * Input parameters: + * mbfid - id of message buffer to allocate + * status - pointer to status variable + * + * Output parameters: + * returns - pointer to the message buffer control block + * *status - status + */ + +RTEMS_INLINE_ROUTINE ITRON_Message_buffer_Control + *_ITRON_Message_buffer_Allocate( + ID mbfid +) +{ + return (ITRON_Message_buffer_Control *)_ITRON_Objects_Allocate_by_index( + &_ITRON_Message_buffer_Information, + mbfid, + sizeof(ITRON_Message_buffer_Control) + ); +} + +/* + * _ITRON_Message_buffer_Clarify_allocation_id_error + * + * This function is invoked when an object allocation ID error + * occurs to determine the specific ITRON error code to return. + */ + +#define _ITRON_Message_buffer_Clarify_allocation_id_error( _id ) \ + _ITRON_Objects_Clarify_allocation_id_error( \ + &_ITRON_Message_buffer_Information, (_id) ) + +/* + * _ITRON_Message_buffer_Clarify_get_id_error + * + * This function is invoked when an object get ID error + * occurs to determine the specific ITRON error code to return. + */ + +#define _ITRON_Message_buffer_Clarify_get_id_error( _id ) \ + _ITRON_Objects_Clarify_get_id_error( &_ITRON_Message_buffer_Information, (_id) ) + +/* + * _ITRON_Message_buffer_Free + * + * DESCRIPTION: + * + * This routine frees a message buffer control block to the + * inactive chain of free message buffer control blocks. + * + * Input parameters: + * the_message_buffer - pointer to message_buffer control block + * + * Output parameters: NONE + */ + +RTEMS_INLINE_ROUTINE void _ITRON_Message_buffer_Free ( + ITRON_Message_buffer_Control *the_message_buffer +) +{ + _ITRON_Objects_Free( + &_ITRON_Message_buffer_Information, + &the_message_buffer->Object + ); +} + +/*PAGE + * + * _ITRON_Message_buffer_Get + * + * DESCRIPTION: + * + * This function maps message buffer IDs to message buffer control blocks. + * If ID corresponds to a local message buffer, then it returns + * the message buffer control pointer which maps to ID and location + * is set to OBJECTS_LOCAL. if the message buffer ID is global and + * resides on a remote node, then location is set to OBJECTS_REMOTE, + * and the message buffer is undefined. Otherwise, location is set + * to OBJECTS_ERROR and the message buffer is undefined. + * + * Input parameters: + * id - ITRON message_buffer ID. + * the_location - pointer to a location variable + * + * Output parameters: + * *the_location - location of the object + */ + +RTEMS_INLINE_ROUTINE ITRON_Message_buffer_Control *_ITRON_Message_buffer_Get ( + ID id, + Objects_Locations *location +) +{ + return (ITRON_Message_buffer_Control *) + _ITRON_Objects_Get( &_ITRON_Message_buffer_Information, id, location ); +} + +/*PAGE + * + * _ITRON_Message_buffer_Is_null + * + * This function returns TRUE if the_message_buffer is NULL + * and FALSE otherwise. + * + * Input parameters: + * the_message_buffer - pointer to message buffer control block + * + * Output parameters: + * TRUE - if the_message_buffer is NULL + * FALSE - otherwise + */ + +RTEMS_INLINE_ROUTINE boolean _ITRON_Message_buffer_Is_null ( + ITRON_Message_buffer_Control *the_message_buffer +) +{ + return ( the_message_buffer == NULL ); +} + +/* + * XXX insert inline routines here + */ + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/inline/rtems/itron/network.inl b/cpukit/itron/inline/rtems/itron/network.inl new file mode 100644 index 0000000000..d4932383fc --- /dev/null +++ b/cpukit/itron/inline/rtems/itron/network.inl @@ -0,0 +1,27 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_NETWORK_inl_ +#define __ITRON_NETWORK_inl_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * XXX insert inline routines here + */ + + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/inline/rtems/itron/port.inl b/cpukit/itron/inline/rtems/itron/port.inl new file mode 100644 index 0000000000..5004761487 --- /dev/null +++ b/cpukit/itron/inline/rtems/itron/port.inl @@ -0,0 +1,148 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_PORT_inl_ +#define __ITRON_PORT_inl_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * _ITRON_Port_Allocate + * + * DESCRIPTION: + * + * This routine allocates the port associated with the specified + * port ID from the pool of inactive ports. + * + * Input parameters: + * porid - id of port to allocate + * status - pointer to status variable + * + * Output parameters: + * returns - pointer to the port control block + * *status - status + */ + +RTEMS_INLINE_ROUTINE ITRON_Port_Control *_ITRON_Port_Allocate( + ID porid +) +{ + return (ITRON_Port_Control *)_ITRON_Objects_Allocate_by_index( + &_ITRON_Port_Information, + porid, + sizeof(ITRON_Port_Control) + ); +} + +/* + * _ITRON_Port_Clarify_allocation_id_error + * + * This function is invoked when an object allocation ID error + * occurs to determine the specific ITRON error code to return. + */ + +#define _ITRON_Port_Clarify_allocation_id_error( _id ) \ + _ITRON_Objects_Clarify_allocation_id_error( \ + &_ITRON_Port_Information, (_id) ) + +/* + * _ITRON_Port_Clarify_get_id_error + * + * This function is invoked when an object get ID error + * occurs to determine the specific ITRON error code to return. + */ + +#define _ITRON_Port_Clarify_get_id_error( _id ) \ + _ITRON_Objects_Clarify_get_id_error( &_ITRON_Port_Information, (_id) ) + +/* + * _ITRON_Port_Free + * + * DESCRIPTION: + * + * This routine frees a port control block to the + * inactive chain of free port control blocks. + * + * Input parameters: + * the_port - pointer to port control block + * + * Output parameters: NONE + */ + +RTEMS_INLINE_ROUTINE void _ITRON_Port_Free ( + ITRON_Port_Control *the_port +) +{ + _ITRON_Objects_Free( &_ITRON_Port_Information, &the_port->Object ); +} + +/*PAGE + * + * _ITRON_Port_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. if the port ID is global and + * resides on a remote node, then location is set to OBJECTS_REMOTE, + * and the_port is undefined. Otherwise, location is set + * to OBJECTS_ERROR and the_port is undefined. + * + * Input parameters: + * id - ITRON port ID. + * the_location - pointer to a location variable + * + * Output parameters: + * *the_location - location of the object + */ + +RTEMS_INLINE_ROUTINE ITRON_Port_Control *_ITRON_Port_Get ( + ID id, + Objects_Locations *location +) +{ + return (ITRON_Port_Control *) + _ITRON_Objects_Get( &_ITRON_Port_Information, id, location ); +} + +/*PAGE + * + * _ITRON_Port_Is_null + * + * This function returns TRUE if the_port is NULL and FALSE otherwise. + * + * Input parameters: + * the_port - pointer to port control block + * + * Output parameters: + * TRUE - if the_port is NULL + * FALSE - otherwise + */ + +RTEMS_INLINE_ROUTINE boolean _ITRON_Port_Is_null ( + ITRON_Port_Control *the_port +) +{ + return ( the_port == NULL ); +} + +/* + * XXX insert inline routines here + */ + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/inline/rtems/itron/semaphore.inl b/cpukit/itron/inline/rtems/itron/semaphore.inl new file mode 100644 index 0000000000..6e6595fcdc --- /dev/null +++ b/cpukit/itron/inline/rtems/itron/semaphore.inl @@ -0,0 +1,180 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_SEMAPHORE_inl_ +#define __ITRON_SEMAPHORE_inl_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * _ITRON_Semaphore_Allocate + * + * DESCRIPTION: + * + * This routine allocates the semaphore associated with the specified + * semaphore ID from the pool of inactive semaphores. + * + * Input parameters: + * semid - id of semaphore to allocate + * status - pointer to status variable + * + * Output parameters: + * returns - pointer to the semaphore control block + * *status - status + */ + +RTEMS_INLINE_ROUTINE ITRON_Semaphore_Control *_ITRON_Semaphore_Allocate( + ID semid +) +{ + return (ITRON_Semaphore_Control *)_ITRON_Objects_Allocate_by_index( + &_ITRON_Semaphore_Information, + semid, + sizeof(ITRON_Semaphore_Control) + ); +} + +/* + * _ITRON_Semaphore_Clarify_allocation_id_error + * + * This function is invoked when an object allocation ID error + * occurs to determine the specific ITRON error code to return. + */ + +#define _ITRON_Semaphore_Clarify_allocation_id_error( _id ) \ + _ITRON_Objects_Clarify_allocation_id_error( \ + &_ITRON_Semaphore_Information, (_id) ) + +/* + * _ITRON_Semaphore_Clarify_get_id_error + * + * This function is invoked when an object get ID error + * occurs to determine the specific ITRON error code to return. + */ + +#define _ITRON_Semaphore_Clarify_get_id_error( _id ) \ + _ITRON_Objects_Clarify_get_id_error( &_ITRON_Semaphore_Information, (_id) ) + +/* + * _ITRON_Semaphore_Free + * + * DESCRIPTION: + * + * This routine frees a semaphore control block to the + * inactive chain of free semaphore control blocks. + * + * Input parameters: + * the_semaphore - pointer to semaphore control block + * + * Output parameters: NONE + */ + +RTEMS_INLINE_ROUTINE void _ITRON_Semaphore_Free ( + ITRON_Semaphore_Control *the_semaphore +) +{ + _ITRON_Objects_Free( &_ITRON_Semaphore_Information, &the_semaphore->Object ); +} + +/*PAGE + * + * _ITRON_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. + * + * Input parameters: + * id - ITRON semaphore ID. + * the_location - pointer to a location variable + * + * Output parameters: + * *the_location - location of the object + */ + +RTEMS_INLINE_ROUTINE ITRON_Semaphore_Control *_ITRON_Semaphore_Get ( + ID id, + Objects_Locations *location +) +{ + return (ITRON_Semaphore_Control *) + _ITRON_Objects_Get( &_ITRON_Semaphore_Information, id, location ); +} + +/*PAGE + * + * _ITRON_Semaphore_Is_null + * + * This function returns TRUE if the_semaphore is NULL and FALSE otherwise. + * + * Input parameters: + * the_semaphore - pointer to semaphore control block + * + * Output parameters: + * TRUE - if the_semaphore is NULL + * FALSE - otherwise + */ + +RTEMS_INLINE_ROUTINE boolean _ITRON_Semaphore_Is_null ( + ITRON_Semaphore_Control *the_semaphore +) +{ + return ( the_semaphore == NULL ); +} + +/* + * _ITRON_Semaphore_Translate_core_semaphore_return_code + * + * This function returns a ITRON status code based on the semaphore + * status code specified. + * + * Input parameters: + * the_semaphore_status - semaphore status code to translate + * + * Output parameters: + * ITRON status code - translated ITRON status code + * + */ + +RTEMS_INLINE_ROUTINE ER _ITRON_Semaphore_Translate_core_semaphore_return_code ( + unsigned32 the_semaphore_status +) +{ +/* XXX need to be able to return "E_RLWAI" */ + switch ( the_semaphore_status ) { + case CORE_SEMAPHORE_STATUS_SUCCESSFUL: + return E_OK; + case CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT: + return E_TMOUT; + case CORE_SEMAPHORE_WAS_DELETED: + return E_DLT; + case CORE_SEMAPHORE_TIMEOUT: + return E_TMOUT; + case CORE_SEMAPHORE_MAXIMUM_COUNT_EXCEEDED: + return E_QOVR; + case THREAD_STATUS_PROXY_BLOCKING: + return THREAD_STATUS_PROXY_BLOCKING; + } + return E_OK; /* unreached - only to remove warnings */ +} + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/inline/rtems/itron/sysmgmt.inl b/cpukit/itron/inline/rtems/itron/sysmgmt.inl new file mode 100644 index 0000000000..2a2eb76c6e --- /dev/null +++ b/cpukit/itron/inline/rtems/itron/sysmgmt.inl @@ -0,0 +1,27 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_TIME_inl_ +#define __ITRON_TIME_inl_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * XXX insert inline routines here + */ + + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/inline/rtems/itron/task.inl b/cpukit/itron/inline/rtems/itron/task.inl new file mode 100644 index 0000000000..1833fee84a --- /dev/null +++ b/cpukit/itron/inline/rtems/itron/task.inl @@ -0,0 +1,160 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_TASK_inl_ +#define __ITRON_TASK_inl_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * _ITRON_Task_Allocate + * + * DESCRIPTION: + * + * This routine allocates the task associated with the specified + * task ID from the pool of inactive tasks. + * + * Input parameters: + * tskid - id of task to allocate + * status - pointer to status variable + * + * Output parameters: + * returns - pointer to the task control block + * *status - status + */ + +RTEMS_INLINE_ROUTINE Thread_Control *_ITRON_Task_Allocate( + ID tskid +) +{ + return (Thread_Control *)_ITRON_Objects_Allocate_by_index( + &_ITRON_Task_Information, + tskid, + sizeof(Thread_Control) + ); +} + +/* + * _ITRON_Task_Clarify_allocation_id_error + * + * This function is invoked when an object allocation ID error + * occurs to determine the specific ITRON error code to return. + */ + +#define _ITRON_Task_Clarify_allocation_id_error( _id ) \ + _ITRON_Objects_Clarify_allocation_id_error( \ + &_ITRON_Task_Information, (_id) ) + +/* + * _ITRON_Task_Clarify_get_id_error + * + * This function is invoked when an object get ID error + * occurs to determine the specific ITRON error code to return. + */ + +#define _ITRON_Task_Clarify_get_id_error( _id ) \ + _ITRON_Objects_Clarify_get_id_error( &_ITRON_Task_Information, (_id) ) + +/* + * _ITRON_Task_Free + * + * DESCRIPTION: + * + * This routine frees a task control block to the + * inactive chain of free task control blocks. + * + * Input parameters: + * the_task - pointer to task control block + * + * Output parameters: NONE + */ + +RTEMS_INLINE_ROUTINE void _ITRON_Task_Free ( + Thread_Control *the_task +) +{ + _ITRON_Objects_Free( &_ITRON_Task_Information, &the_task->Object ); +} + +/*PAGE + * + * _ITRON_Task_Get + * + * DESCRIPTION: + * + * This function maps task IDs to task control blocks. + * If ID corresponds to a local task, then it returns + * the_task control pointer which maps to ID and location + * is set to OBJECTS_LOCAL. if the task ID is global and + * resides on a remote node, then location is set to OBJECTS_REMOTE, + * and the_task is undefined. Otherwise, location is set + * to OBJECTS_ERROR and the_task is undefined. + * + * Input parameters: + * id - ITRON task ID. + * the_location - pointer to a location variable + * + * Output parameters: + * *the_location - location of the object + */ + +RTEMS_INLINE_ROUTINE Thread_Control *_ITRON_Task_Get ( + ID id, + Objects_Locations *location +) +{ + return (Thread_Control *) + _ITRON_Objects_Get( &_ITRON_Task_Information, id, location ); +} + +/*PAGE + * + * _ITRON_Task_Is_null + * + * This function returns TRUE if the_task is NULL and FALSE otherwise. + * + * Input parameters: + * the_task - pointer to task control block + * + * Output parameters: + * TRUE - if the_task is NULL + * FALSE - otherwise + */ + +RTEMS_INLINE_ROUTINE boolean _ITRON_Task_Is_null ( + Thread_Control *the_task +) +{ + return ( the_task == NULL ); +} + +/* + * XXX insert inline routines here + */ + +/*PAGE + * + * _ITRON_tasks_Priority_to_Core + */ + +RTEMS_INLINE_ROUTINE Priority_Control _ITRON_Task_Priority_to_Core( + PRI _priority +) +{ + return ((Priority_Control) (_priority)); +} + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/inline/rtems/itron/time.inl b/cpukit/itron/inline/rtems/itron/time.inl new file mode 100644 index 0000000000..2a2eb76c6e --- /dev/null +++ b/cpukit/itron/inline/rtems/itron/time.inl @@ -0,0 +1,27 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_TIME_inl_ +#define __ITRON_TIME_inl_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * XXX insert inline routines here + */ + + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/inline/rtems/itron/vmempool.inl b/cpukit/itron/inline/rtems/itron/vmempool.inl new file mode 100644 index 0000000000..eec2931fb2 --- /dev/null +++ b/cpukit/itron/inline/rtems/itron/vmempool.inl @@ -0,0 +1,158 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#ifndef __ITRON_VARIABLE_MEMORY_POOL_inl_ +#define __ITRON_VARIABLE_MEMORY_POOL_inl_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * _ITRON_Variable_memory_pool_Allocate + * + * DESCRIPTION: + * + * This routine allocates the variable memory pool associated with + * the specified variable memory pool ID from the pool of inactive + * variable memory pools. + * + * Input parameters: + * mplid - id of variable memory pool to allocate + * status - pointer to status variable + * + * Output parameters: + * returns - pointer to the variable memory pool control block + * *status - status + */ + +RTEMS_INLINE_ROUTINE ITRON_Variable_memory_pool_Control + *_ITRON_Variable_memory_pool_Allocate( + ID mplid +) +{ + return (ITRON_Variable_memory_pool_Control *)_ITRON_Objects_Allocate_by_index( + &_ITRON_Variable_memory_pool_Information, + mplid, + sizeof(ITRON_Variable_memory_pool_Control) + ); +} + +/* + * _ITRON_Variable_memory_pool_Clarify_allocation_id_error + * + * This function is invoked when an object allocation ID error + * occurs to determine the specific ITRON error code to return. + */ + +#define _ITRON_Variable_memory_pool_Clarify_allocation_id_error( _id ) \ + _ITRON_Objects_Clarify_allocation_id_error( \ + &_ITRON_Variable_memory_pool_Information, (_id) ) + +/* + * _ITRON_Variable_memory_pool_Clarify_get_id_error + * + * This function is invoked when an object get ID error + * occurs to determine the specific ITRON error code to return. + */ + +#define _ITRON_Variable_memory_pool_Clarify_get_id_error( _id ) \ + _ITRON_Objects_Clarify_get_id_error( &_ITRON_Variable_memory_pool_Information, (_id) ) + +/* + * _ITRON_Variable_memory_pool_Free + * + * DESCRIPTION: + * + * This routine frees a variable memory pool control block to the + * inactive chain of free variable memory pool control blocks. + * + * Input parameters: + * the_variable_memory_pool - pointer to variable memory pool control block + * + * Output parameters: NONE + */ + +RTEMS_INLINE_ROUTINE void _ITRON_Variable_memory_pool_Free ( + ITRON_Variable_memory_pool_Control *the_variable_memory_pool +) +{ + _ITRON_Objects_Free( + &_ITRON_Variable_memory_pool_Information, + &the_variable_memory_pool->Object + ); +} + +/*PAGE + * + * _ITRON_Variable_memory_pool_Get + * + * DESCRIPTION: + * + * This function maps variable memory pool IDs to variable memory pool + * control blocks. If ID corresponds to a local variable memory pool, + * then it returns the variable memory pool control pointer which maps + * to ID and location is set to OBJECTS_LOCAL. if the variable memory + * pool ID is global and resides on a remote node, then location is set + * to OBJECTS_REMOTE, and the variable memory pool is undefined. Otherwise, + * location is set to OBJECTS ERROR and the variable memory pool is undefined. + * + * Input parameters: + * id - ITRON variable memory pool ID. + * the_location - pointer to a location variable + * + * Output parameters: + * *the_location - location of the object + */ + +RTEMS_INLINE_ROUTINE ITRON_Variable_memory_pool_Control + *_ITRON_Variable_memory_pool_Get ( + ID id, + Objects_Locations *location +) +{ + return (ITRON_Variable_memory_pool_Control *) _ITRON_Objects_Get( + &_ITRON_Variable_memory_pool_Information, + id, + location + ); +} + +/*PAGE + * + * _ITRON_Variable_memory_pool_Is_null + * + * This function returns TRUE if the_variable_memory_pool is NULL + * and FALSE otherwise. + * + * Input parameters: + * the_variable_memory_pool - pointer to variable memory pool control block + * + * Output parameters: + * TRUE - if the_variable_memory_pool is NULL + * FALSE - otherwise + */ + +RTEMS_INLINE_ROUTINE boolean _ITRON_Variable_memory_pool_Is_null ( + ITRON_Variable_memory_pool_Control *the_variable_memory_pool +) +{ + return ( the_variable_memory_pool == NULL ); +} + +/* + * XXX insert inline routines here + */ + +#ifdef __cplusplus +} +#endif + +#endif +/* end of include file */ + diff --git a/cpukit/itron/src/can_wup.c b/cpukit/itron/src/can_wup.c new file mode 100644 index 0000000000..d75d379de9 --- /dev/null +++ b/cpukit/itron/src/can_wup.c @@ -0,0 +1,30 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + +/* + * can_wup - Cancel Wakeup Request + */ + +ER can_wup( + INT *p_wupcnt, + ID tskid +) +{ + return E_OK; +} + diff --git a/cpukit/itron/src/chg_pri.c b/cpukit/itron/src/chg_pri.c new file mode 100644 index 0000000000..b2d42905e5 --- /dev/null +++ b/cpukit/itron/src/chg_pri.c @@ -0,0 +1,30 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + +/* + * chg_pri - Change Task Priority + */ + +ER chg_pri( + ID tskid, + PRI tskpri +) +{ + return E_OK; +} + diff --git a/cpukit/itron/src/cre_tsk.c b/cpukit/itron/src/cre_tsk.c new file mode 100644 index 0000000000..76bcd75eda --- /dev/null +++ b/cpukit/itron/src/cre_tsk.c @@ -0,0 +1,127 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + + +/* + * cre_tsk - Create Task + */ + +/* + * XXX - How do I return these errors ??? Do I have to validate the ID + prior to calling the ID routine ?? + E_NOMEM Insufficient memory (Memory for control block and/or user stack + cannot be allocated) + E_ID Invalid ID Number (tskid was invalid or could not be used) + E_RSATR Reserved attribute (tskatr was invalid or could not be used) + E_OBJ Invalid object state (a task of the same ID already exists) + E_OACV Object access violation (A tskid less than -4 was specified from + a user task. This is implementation dependent.) + E_PAR Parameter error (pk_ctsk, task, itskpri and/or stksz is invalid) + EN_OBJNO An object number which could not be accessed on the target node + is specified. + EN_CTXID Specified an object on another node when the system call was + issued from a task in dispatch disabled state or from a task- + independent portion + EN_PAR A value outside the range supported by the target node and/or + transmission packet format was specified as a parameter (a value + outside supported range was specified for exinf, tskatr, task, + itskpri and/or stksz) + */ + +ER cre_tsk( + ID tskid, + T_CTSK *pk_ctsk +) +{ + register Thread_Control *the_thread; + char *name = "trn"; + boolean status; + Priority_Control core_priority; + + /* + * Disable dispatching. + */ + + _Thread_Disable_dispatch(); + + /* + * allocate the thread. + */ + + the_thread = _ITRON_Task_Allocate( tskid ); + if ( !the_thread ) { + ena_dsp(); + return _ITRON_Task_Clarify_allocation_id_error( tskid ); + } + + /* + * XXX - FIX THE VARIABLES TO THE CORRECT VALUES!!! + */ + + /* + * Initialize the core thread for this task. + */ + + core_priority = _ITRON_Task_Priority_to_Core( pk_ctsk->itskpri ); + status = _Thread_Initialize( + &_ITRON_Task_Information, + the_thread, + NULL, + pk_ctsk->stksz, + TRUE, /* XXX - All tasks FP ??? */ + core_priority, + TRUE, + THREAD_CPU_BUDGET_ALGORITHM_EXHAUST_TIMESLICE, + NULL, /* no budget algorithm callout */ + 0, + &name + ); + + if ( !status ) { + _ITRON_Task_Free( the_thread ); + _Thread_Enable_dispatch(); + return -1; +#if (0) +/* XXX */ +#endif + } + +#if (0) /* XXX We have any thing else to set per API structure? */ + api = the_thread->API_Extensions[ THREAD_API_ITRON ]; + asr = &api->Signal; + + asr->is_enabled = FALSE; + + *id = the_thread->Object.id; +#endif + + /* + * This insures we evaluate the process-wide signals pending when we + * first run. + * + * NOTE: Since the thread starts with all unblocked, this is necessary. + */ + + the_thread->do_post_task_switch_extension = TRUE; + + the_thread->Start.entry_point = (Thread_Entry) pk_ctsk->task; + + _Thread_Enable_dispatch(); + return E_OK; +} + diff --git a/cpukit/itron/src/del_tsk.c b/cpukit/itron/src/del_tsk.c new file mode 100644 index 0000000000..5230acddca --- /dev/null +++ b/cpukit/itron/src/del_tsk.c @@ -0,0 +1,50 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + + +/* + * del_tsk - Delete Task + */ + +ER del_tsk( + ID tskid +) +{ + register Thread_Control *the_thread; + Objects_Locations location; + ER result; + + /* XXX - Fix Documentation and error checking for this error on self */ + + the_thread = _ITRON_Task_Get( tskid, &location ); + _Thread_Disable_dispatch(); + + switch ( location ) { + case OBJECTS_REMOTE: + case OBJECTS_ERROR: + _Thread_Enable_dispatch(); + return _ITRON_Task_Clarify_get_id_error( tskid ); + + case OBJECTS_LOCAL: + result = _ITRON_Delete_task( the_thread ); + } + + _Thread_Enable_dispatch(); + return E_OK; +} + diff --git a/cpukit/itron/src/dis_dsp.c b/cpukit/itron/src/dis_dsp.c new file mode 100644 index 0000000000..348a3d64af --- /dev/null +++ b/cpukit/itron/src/dis_dsp.c @@ -0,0 +1,35 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + + +/* + * dis_dsp - Disable Dispatch + */ + +ER dis_dsp( void ) +{ + /* + * Disable dispatch for protection + */ + + _Thread_Disable_dispatch(); + + return E_OK; +} + + diff --git a/cpukit/itron/src/ena_dsp.c b/cpukit/itron/src/ena_dsp.c new file mode 100644 index 0000000000..7c4d86f4d5 --- /dev/null +++ b/cpukit/itron/src/ena_dsp.c @@ -0,0 +1,30 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + + +/* + * ena_dsp - Enable Dispatch + */ + +ER ena_dsp( void ) +{ + _Thread_Enable_dispatch(); + + return E_OK; +} + diff --git a/cpukit/itron/src/eventflags.c b/cpukit/itron/src/eventflags.c new file mode 100644 index 0000000000..6855593391 --- /dev/null +++ b/cpukit/itron/src/eventflags.c @@ -0,0 +1,152 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include + +/* + * _ITRON_Eventflags_Manager_initialization + * + * This routine initializes all event flags manager related data structures. + * + * Input parameters: + * maximum_eventflags - maximum configured eventflags + * + * Output parameters: NONE + */ + +void _ITRON_Eventflags_Manager_initialization( + unsigned32 maximum_eventflags +) +{ + _Objects_Initialize_information( + &_ITRON_Eventflags_Information, /* object information table */ + OBJECTS_ITRON_EVENTFLAGS, /* object class */ + FALSE, /* TRUE if this is a global */ + /* object class */ + maximum_eventflags, /* maximum objects of this class */ + sizeof( ITRON_Eventflags_Control ), /* size of this object's */ + /* control block */ + FALSE, /* TRUE if names for this object */ + /* are strings */ + RTEMS_MAXIMUM_NAME_LENGTH, /* maximum length of each object's */ + /* name */ + FALSE /* TRUE if this class is threads */ + ); + + /* + * Register the MP Process Packet routine. + * + * NOTE: No MP Support YET in RTEMS ITRON implementation. + */ + +} + +/* + * cre_flg - Create Eventflag + */ + +ER cre_flg( + ID flgid, + T_CFLG *pk_cflg +) +{ + return E_OK; +} + +/* + * del_flg - Delete Eventflag + */ + +ER del_flg( + ID flgid +) +{ + return E_OK; +} + +/* + * set_flg - Set Eventflag + */ + +ER set_flg( + ID flgid, + UINT setptn +) +{ + return E_OK; +} + +/* + * clr_flg - Clear Eventflag + */ + +ER clr_flg( + ID flgid, + UINT clrptn +) +{ + return E_OK; +} + +/* + * wai_flg - Wait on Eventflag + */ + +ER wai_flg( + UINT *p_flgptn, + ID flgid, + UINT waiptn, + UINT wfmode +) +{ + return E_OK; +} + +/* + * pol_flg - Wait for Eventflag(Polling) + */ + +ER pol_flg( + UINT *p_flgptn, + ID flgid, + UINT waiptn, + UINT wfmode +) +{ + return E_OK; +} + +/* + * twai_flg - Wait on Eventflag with Timeout + */ + +ER twai_flg( + UINT *p_flgptn, + ID flgid, + UINT waiptn, + UINT wfmode, + TMO tmout +) +{ + return E_OK; +} + +/* + * ref_flg - Reference Eventflag Status + */ + +ER ref_flg( + T_RFLG *pk_rflg, + ID flgid +) +{ + return E_OK; +} + diff --git a/cpukit/itron/src/exd_tsk.c b/cpukit/itron/src/exd_tsk.c new file mode 100644 index 0000000000..c2b86f3126 --- /dev/null +++ b/cpukit/itron/src/exd_tsk.c @@ -0,0 +1,40 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include +#include + +#include +#include +#include +#include +#include + +#include + +/* + * exd_tsk - Exit and Delete Task + */ + +void exd_tsk( void ) +{ + Objects_Information *the_information; + + the_information = _Objects_Get_information( _Thread_Executing->Object.id ); + + /* This should never happen if _Thread_Get() works right */ + assert( the_information ); + + _Thread_Disable_dispatch(); + + _Thread_Set_state( _Thread_Executing, STATES_DORMANT ); + _ITRON_Delete_task( _Thread_Executing ); + + _Thread_Enable_dispatch(); +} + diff --git a/cpukit/itron/src/ext_tsk.c b/cpukit/itron/src/ext_tsk.c new file mode 100644 index 0000000000..a8a3b0ec23 --- /dev/null +++ b/cpukit/itron/src/ext_tsk.c @@ -0,0 +1,27 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + + +/* + * ext_tsk - Exit Issuing Task + */ + +void ext_tsk( void ) +{ + _Thread_Set_state( _Thread_Executing, STATES_DORMANT ); +} diff --git a/cpukit/itron/src/fmempool.c b/cpukit/itron/src/fmempool.c new file mode 100644 index 0000000000..af4b931791 --- /dev/null +++ b/cpukit/itron/src/fmempool.c @@ -0,0 +1,135 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include + +/* + * _ITRON_Fixed_memory_pool_Manager_initialization + * + * This routine initializes all fixed memory pool manager related + * data structures. + * + * Input parameters: + * maximum_fixed_memory_pools - maximum configured fixed memory pools + * + * Output parameters: NONE + */ + +void _ITRON_Fixed_memory_pool_Manager_initialization( + unsigned32 maximum_fixed_memory_pools +) +{ + _Objects_Initialize_information( + &_ITRON_Fixed_memory_pool_Information, /* object information table */ + OBJECTS_ITRON_FIXED_MEMORY_POOLS, /* object class */ + FALSE, /* TRUE if this is a global */ + /* object class */ + maximum_fixed_memory_pools, /* maximum objects of this class */ + sizeof( ITRON_Fixed_memory_pool_Control ), + /* size of this object's control block */ + FALSE, /* TRUE if names for this object */ + /* are strings */ + RTEMS_MAXIMUM_NAME_LENGTH, /* maximum length of each object's */ + /* name */ + FALSE /* TRUE if this class is threads */ + ); + + /* + * Register the MP Process Packet routine. + * + * NOTE: No MP Support YET in RTEMS ITRON implementation. + */ + +} + +/* + * cre_mpf - Create Fixed-Size Memorypool + */ + +ER cre_mpf( + ID mpfid, + T_CMPF *pk_cmpf +) +{ + return E_OK; +} + +/* + * del_mpf - Delete Fixed-Size Memorypool + */ + +ER del_mpf( + ID mpfid +) +{ + return E_OK; +} + +/* + * get_blf - Get Fixed-Size Memory Block + */ + +ER get_blf( + VP *p_blf, + ID mpfid +) +{ + return E_OK; +} + +/* + * pget_blf - Poll and Get Fixed-Size Memory Block + */ + +ER pget_blf( + VP *p_blf, + ID mpfid +) +{ + return E_OK; +} + +/* + * tget_blf - Get Fixed-Size Memory Block with Timeout + */ + +ER tget_blf( + VP *p_blf, + ID mpfid, + TMO tmout +) +{ + return E_OK; +} + +/* + * rel_blf - Release Fixed-Size Memory Block + */ + +ER rel_blf( + ID mpfid, + VP blf +) +{ + return E_OK; +} + +/* + * ref_mpf - Reference Fixed-Size Memorypool Status + */ + +ER ref_mpf( + T_RMPF *pk_rmpf, + ID mpfid +) +{ + return E_OK; +} + diff --git a/cpukit/itron/src/frsm_tsk.c b/cpukit/itron/src/frsm_tsk.c new file mode 100644 index 0000000000..8fe5e9e6fc --- /dev/null +++ b/cpukit/itron/src/frsm_tsk.c @@ -0,0 +1,31 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + + +/* + * frsm_tsk - Forcibly Resume Suspended Task + */ + +ER frsm_tsk( + ID tskid +) +{ + return E_OK; +} + + diff --git a/cpukit/itron/src/get_tid.c b/cpukit/itron/src/get_tid.c new file mode 100644 index 0000000000..1c5175052a --- /dev/null +++ b/cpukit/itron/src/get_tid.c @@ -0,0 +1,29 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + +/* + * get_tid - Get Task Identifier + */ + +ER get_tid( + ID *p_tskid +) +{ + return E_OK; +} + diff --git a/cpukit/itron/src/itronintr.c b/cpukit/itron/src/itronintr.c new file mode 100644 index 0000000000..14e1d6d67e --- /dev/null +++ b/cpukit/itron/src/itronintr.c @@ -0,0 +1,104 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include + +/* + * def_int - Define Interrupt Handler + */ + +ER def_int( + UINT dintno, + T_DINT *pk_dint +) +{ + return E_OK; +} + +/* + * ret_int - Return from Interrupt Handler + */ + +void ret_int( void ) +{ +} + +/* + * ret_wup - Return and Wakeup Task + */ + +void ret_wup( + ID tskid +) +{ +} + +/* + * loc_cpu - Lock CPU + */ + +ER loc_cpu( void ) +{ + return E_OK; +} + +/* + * unl_cpu - Unlock CPU + */ + +ER unl_cpu( void ) +{ + return E_OK; +} + +/* + * dis_int - Disable Interrupt + */ + +ER dis_int( + UINT eintno +) +{ + return E_OK; +} + +/* + * ena_int - Enable Interrupt + */ + +ER ena_int( + UINT eintno +) +{ + return E_OK; +} + +/* + * chg_iXX - Change Interrupt Mask(Level or Priority) + */ + +ER chg_iXX( + UINT iXXXX +) +{ + return E_OK; +} + +/* + * ref_iXX - Reference Interrupt Mask(Level or Priority) + */ + +ER ref_iXX( + UINT *p_iXXXX +) +{ + return E_OK; +} + diff --git a/cpukit/itron/src/itronsem.c b/cpukit/itron/src/itronsem.c new file mode 100644 index 0000000000..a41775f0f6 --- /dev/null +++ b/cpukit/itron/src/itronsem.c @@ -0,0 +1,337 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include + +/* + * _ITRON_Semaphore_Manager_initialization + * + * DESCRIPTION: + * + * This routine initializes all semaphore manager related data structures. + * + * Input parameters: + * maximum_semaphores - maximum configured semaphores + * + * Output parameters: NONE + */ + +void _ITRON_Semaphore_Manager_initialization( + unsigned32 maximum_semaphores +) +{ + _Objects_Initialize_information( + &_ITRON_Semaphore_Information, /* object information table */ + OBJECTS_ITRON_SEMAPHORES, /* object class */ + FALSE, /* TRUE if this is a global */ + /* object class */ + maximum_semaphores, /* maximum objects of this class */ + sizeof( ITRON_Semaphore_Control ), /* size of this object's control block */ + FALSE, /* TRUE if names for this object */ + /* are strings */ + RTEMS_MAXIMUM_NAME_LENGTH, /* maximum length of each object's */ + /* name */ + FALSE /* TRUE if this class is threads */ + ); + + /* + * Register the MP Process Packet routine. + * + * NOTE: No MP Support YET in RTEMS ITRON implementation. + */ + +} + +/* + * cre_sem - Create Semaphore + * + * This function implements the ITRON 3.0 cre_sem() service. + */ + +ER cre_sem( + ID semid, + T_CSEM *pk_csem +) +{ + CORE_semaphore_Attributes the_semaphore_attributes; + ITRON_Semaphore_Control *the_semaphore; + + /* + * Bad pointer to the attributes structure + */ + + if ( !pk_csem ) + return E_PAR; + + /* + * Bits were set that were note defined. + */ + + if ( pk_csem->sematr & _ITRON_SEMAPHORE_UNUSED_ATTRIBUTES ) + return E_RSATR; + + /* + * Initial semaphore count exceeds the maximum. + */ + + if ( pk_csem->isemcnt > pk_csem->maxsem ) + return E_PAR; + + /* + * This error is not in the specification but this condition + * does not make sense. + */ + + if ( pk_csem->maxsem == 0 ) + return E_PAR; + + _Thread_Disable_dispatch(); /* prevents deletion */ + + the_semaphore = _ITRON_Semaphore_Allocate( semid ); + if ( !the_semaphore ) { + _Thread_Enable_dispatch(); + return _ITRON_Semaphore_Clarify_allocation_id_error( semid ); + } + + if ( pk_csem->sematr & TA_TPRI ) + the_semaphore_attributes.discipline = CORE_SEMAPHORE_DISCIPLINES_PRIORITY; + else + the_semaphore_attributes.discipline = CORE_SEMAPHORE_DISCIPLINES_FIFO; + + the_semaphore_attributes.maximum_count = pk_csem->maxsem; + + _CORE_semaphore_Initialize( + &the_semaphore->semaphore, + OBJECTS_ITRON_SEMAPHORES, + &the_semaphore_attributes, + pk_csem->isemcnt, + NULL /* Multiprocessing not supported */ + ); + + _ITRON_Objects_Open( &_ITRON_Semaphore_Information, &the_semaphore->Object ); + + /* + * If multiprocessing were supported, this is where we would announce + * the existence of the semaphore to the rest of the system. + */ + +#if defined(RTEMS_MULTIPROCESSING) +#endif + + _Thread_Enable_dispatch(); + return E_OK; +} + +/* + * del_sem - Delete Semaphore + * + * This function implements the ITRON 3.0 del_sem() service. + */ + +ER del_sem( + ID semid +) +{ + ITRON_Semaphore_Control *the_semaphore; + Objects_Locations location; + + the_semaphore = _ITRON_Semaphore_Get( semid, &location ); + switch ( location ) { + case OBJECTS_REMOTE: /* Multiprocessing not supported */ + case OBJECTS_ERROR: + return _ITRON_Semaphore_Clarify_get_id_error( semid ); + + case OBJECTS_LOCAL: + _CORE_semaphore_Flush( + &the_semaphore->semaphore, + NULL, /* Multiprocessing not supported */ + CORE_SEMAPHORE_WAS_DELETED + ); + + _ITRON_Objects_Close( + &_ITRON_Semaphore_Information, + &the_semaphore->Object + ); + + _ITRON_Semaphore_Free( the_semaphore ); + + /* + * If multiprocessing were supported, this is where we would announce + * the destruction of the semaphore to the rest of the system. + */ + +#if defined(RTEMS_MULTIPROCESSING) +#endif + + _Thread_Enable_dispatch(); + return E_OK; + + } + return E_OK; +} + +/* + * sig_sem - Signal Semaphore + * + * This function implements the ITRON 3.0 sig_sem() service. + */ + +ER sig_sem( + ID semid +) +{ + ITRON_Semaphore_Control *the_semaphore; + Objects_Locations location; + CORE_semaphore_Status status; + + the_semaphore = _ITRON_Semaphore_Get( semid, &location ); + switch ( location ) { + case OBJECTS_REMOTE: /* Multiprocessing not supported */ + case OBJECTS_ERROR: + return _ITRON_Semaphore_Clarify_get_id_error( semid ); + + case OBJECTS_LOCAL: + /* + * XXX maxsemcnt + */ + + status = _CORE_semaphore_Surrender( + &the_semaphore->semaphore, + the_semaphore->Object.id, + NULL /* Multiprocessing not supported */ + ); + _Thread_Enable_dispatch(); + return _ITRON_Semaphore_Translate_core_semaphore_return_code( status ); + } + return E_OK; +} + +/* + * wai_sem - Wait on Semaphore + * + * This function implements the ITRON 3.0 wai_sem() service. + */ + +ER wai_sem( + ID semid +) +{ + return twai_sem( semid, TMO_FEVR ); +} + +/* + * preq_sem - Poll and Request Semaphore + * + * This function implements the ITRON 3.0 preq_sem() service. + */ + +ER preq_sem( + ID semid +) +{ + return twai_sem( semid, TMO_POL ); +} + +/* + * twai_sem - Wait on Semaphore with Timeout + * + * This function implements the ITRON 3.0 twai_sem() service. + */ + +ER twai_sem( + ID semid, + TMO tmout +) +{ + ITRON_Semaphore_Control *the_semaphore; + Objects_Locations location; + Watchdog_Interval interval; + boolean wait; + CORE_semaphore_Status status; + + interval = 0; + if ( tmout == TMO_POL ) { + wait = FALSE; + } else { + wait = TRUE; + if ( tmout != TMO_FEVR ) + interval = TOD_MILLISECONDS_TO_TICKS(tmout); + } + + if ( wait && _ITRON_Is_in_non_task_state() ) + return E_CTX; + + the_semaphore = _ITRON_Semaphore_Get( semid, &location ); + switch ( location ) { + case OBJECTS_REMOTE: /* Multiprocessing not supported */ + case OBJECTS_ERROR: + return _ITRON_Semaphore_Clarify_get_id_error( semid ); + + case OBJECTS_LOCAL: + _CORE_semaphore_Seize( + &the_semaphore->semaphore, + the_semaphore->Object.id, + wait, /* wait for a timeout */ + interval /* timeout value */ + ); + _Thread_Enable_dispatch(); + status = (CORE_semaphore_Status) _Thread_Executing->Wait.return_code; + return _ITRON_Semaphore_Translate_core_semaphore_return_code( status ); + } + return E_OK; +} + +/* + * ref_sem - Reference Semaphore Status + * + * This function implements the ITRON 3.0 ref_sem() service. + */ + +ER ref_sem( + ID semid, + T_RSEM *pk_rsem +) +{ + ITRON_Semaphore_Control *the_semaphore; + Objects_Locations location; + + if ( !pk_rsem ) + return E_PAR; /* XXX check this error code */ + + the_semaphore = _ITRON_Semaphore_Get( semid, &location ); + switch ( location ) { + case OBJECTS_REMOTE: /* Multiprocessing not supported */ + case OBJECTS_ERROR: + return _ITRON_Semaphore_Clarify_get_id_error( semid ); + + case OBJECTS_LOCAL: + /* + * Fill in the current semaphore count + */ + + pk_rsem->semcnt = _CORE_semaphore_Get_count( &the_semaphore->semaphore ); + + /* + * Fill in whether or not there is a waiting task + */ + + if ( !_Thread_queue_First( &the_semaphore->semaphore.Wait_queue ) ) + pk_rsem->wtsk = FALSE; + else + pk_rsem->wtsk = TRUE; + + _Thread_Enable_dispatch(); + return E_OK; + } + return E_OK; +} + diff --git a/cpukit/itron/src/itrontime.c b/cpukit/itron/src/itrontime.c new file mode 100644 index 0000000000..13621a9e6a --- /dev/null +++ b/cpukit/itron/src/itrontime.c @@ -0,0 +1,241 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include + +#include + +/* + * set_tim - Set System Clock + */ + +void converTime(SYSTIME ms, TOD_Control *time) +{ + int millisecond; + +/* XXX need to dereference structure */ +#if 0 + milisecond = ms % 1000; + tempSecond = ms / 1000; +#else + millisecond = 0; +#endif +} + + +/* + * set_tim - Set System Clock + */ + +ER set_tim( + SYSTIME *pk_tim +) +{ + Watchdog_Interval temp; /* an integer in seconds after conversion from SYSTIME */ + TOD_Control the_tod; + +/* convert *pk_tim which is 48 bits integer in binary into an ordinary + integer in milliseconds */ + +/* XXX */ temp = 0; + if(temp > 0) { + _Thread_Disable_dispatch(); + _TOD_Set(&the_tod, temp); + _Thread_Enable_dispatch(); + if(_TOD_Validate(&the_tod)){ + return E_OK; + } + } + return E_SYS; +} + +/* + * get_tim - Get System Clock + */ + +ER get_tim( + SYSTIME *pk_tim +) +{ + return E_OK; +} + +/* + * dly_tsk - Delay Task + */ + +ER dly_tsk( + DLYTIME dlytim +) +{ + Watchdog_Interval ticks; + + ticks = TOD_MILLISECONDS_TO_TICKS(dlytim); + + _Thread_Disable_dispatch(); + if ( ticks == 0 ) { + _Thread_Yield_processor(); + } else { + _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 E_OK; +} + +/* + * def_cyc - Define Cyclic Handler + */ + +ER def_cyc( + HNO cycno, + T_DCYC *pk_dcyc +) +{ + Watchdog_Control *object; +#if 0 + Watchdog_Interval timeInterval; +#endif + +/* XXX */ object = 0; + if ( pk_dcyc->cycatr != TA_HLNG) + return E_RSATR; +#if 0 + timeInterval = pk_dcyc->cyctim / 1000; + object->delta_interval = timeInterval; +#endif + _Watchdog_Initialize( + object, + pk_dcyc->cychdr, + cycno, + pk_dcyc->exinf); + _Watchdog_Deactivate(object); + + return E_OK; +} + +/* + * act_cyc - Activate Cyclic Handler + */ + +ER act_cyc( + HNO cycno, + UINT cycact +) +{ + Watchdog_Control *object; + + if(cycact != TCY_OFF || cycact != TCY_ON) + return E_PAR; + +#if 0 + if( object->Object_ID != cycno) + return E_NOEXS; +#endif + + _Watchdog_Activate(object); + + return E_OK; +} + +/* + * ref_cyc - Reference Cyclic Handler Status + */ + +ER ref_cyc( + T_RCYC *pk_rcyc, + HNO cycno +) +{ +#if 0 + int timeElapse_since_actCyclic; +#endif + T_DCYC *pk_dcyc; +#if 0 + Watchdog_Control *object; +#endif + +/* XXX */ pk_dcyc = 0; + +/* XXX will to use a "get" routine to map from id to object pointer */ +/* XXX and the object pointer should be of type specific to this manager */ +#if 0 + if( object->Object_ID == cycno)) +#else + if ( 1 ) +#endif + { + pk_rcyc->exinf = pk_dcyc->exinf; + pk_rcyc->cycact = pk_dcyc->cycact; +#if 0 + pk_rcyc->lfttim = pk_dcyc->cyctim - timeElapse_since_actCyclic; +#endif + + return E_OK; + } + else + return E_NOEXS; +} + +/* + * def_alm - Define Alarm Handler + */ + +ER def_alm( + HNO almno, + T_DALM *pk_dalm +) +{ +#if 0 + Objects_Control *objectAlrm; + Watchdog_Interval timeInterval; + + timeInterval = pk_dalm->almtim / 1000; + (void) _Watchdog_Remove(&objectAlrm); + _Watchdog_Initialize( + objectAlrm, + pk_dalm->almhdr, + almno, + pk_dalm->exinf); + _Watchdong_Insert_seconds(objectAlrm,timeInterval); + _Thread_Enable_dispatch(); +#endif + + return E_OK; +} + +/* + * ref_alm - Reference Alarm Handler Status + */ + +ER ref_alm( + T_RALM *pk_ralm, + HNO almno +) +{ + + return E_OK; +} + +/* + * ret_tmr - Return from Timer Handler + */ + +void ret_tmr( void ) +{ +} + diff --git a/cpukit/itron/src/mbox.c b/cpukit/itron/src/mbox.c new file mode 100644 index 0000000000..c2cc11ec31 --- /dev/null +++ b/cpukit/itron/src/mbox.c @@ -0,0 +1,133 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include + +/* + * _ITRON_Mailbox_Manager_initialization + * + * This routine initializes all mailboxes manager related data structures. + * + * Input parameters: + * maximum_mailboxes - maximum configured mailboxes + * + * Output parameters: NONE + */ + +void _ITRON_Mailbox_Manager_initialization( + unsigned32 maximum_mailboxes +) +{ + _Objects_Initialize_information( + &_ITRON_Mailbox_Information, /* object information table */ + OBJECTS_ITRON_MAILBOXES, /* object class */ + FALSE, /* TRUE if this is a global */ + /* object class */ + maximum_mailboxes, /* maximum objects of this class */ + sizeof( ITRON_Mailbox_Control ), /* size of this object's control block */ + FALSE, /* TRUE if names for this object */ + /* are strings */ + RTEMS_MAXIMUM_NAME_LENGTH, /* maximum length of each object's */ + /* name */ + FALSE /* TRUE if this class is threads */ + ); + + /* + * Register the MP Process Packet routine. + * + * NOTE: No MP Support YET in RTEMS ITRON implementation. + */ + +} + +/* + * cre_mbx - Create Mailbox + */ + +ER cre_mbx( + ID mbxid, + T_CMBX *pk_cmbx +) +{ + return E_OK; +} + +/* + * del_mbx - Delete Mailbox + */ + +ER del_mbx( + ID mbxid +) +{ + return E_OK; +} + +/* + * snd_msg - Send Message to Mailbox + */ + +ER snd_msg( + ID mbxid, + T_MSG *pk_msg +) +{ + return E_OK; +} + +/* + * rcv_msg - Receive Message from Mailbox + */ + +ER rcv_msg( + T_MSG **ppk_msg, + ID mbxid +) +{ + return E_OK; +} + +/* + * prcv_msg - Poll and Receive Message from Mailbox + */ + +ER prcv_msg( + T_MSG **ppk_msg, + ID mbxid +) +{ + return E_OK; +} + +/* + * trcv_msg - Receive Message from Mailbox with Timeout + */ + +ER trcv_msg( + T_MSG **ppk_msg, + ID mbxid, + TMO tmout +) +{ + return E_OK; +} + +/* + * ref_mbx - Reference Mailbox Status + */ + +ER ref_mbx( + T_RMBX *pk_rmbx, + ID mbxid +) +{ + return E_OK; +} + diff --git a/cpukit/itron/src/msgbuffer.c b/cpukit/itron/src/msgbuffer.c new file mode 100644 index 0000000000..4711ddbea9 --- /dev/null +++ b/cpukit/itron/src/msgbuffer.c @@ -0,0 +1,412 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include + +ER _ITRON_Message_buffer_Translate_core_message_buffer_return_code( + CORE_message_queue_Status status) +{ + switch (status) { + case CORE_MESSAGE_QUEUE_STATUS_SUCCESSFUL: + return E_OK; + case CORE_MESSAGE_QUEUE_STATUS_TOO_MANY: + return E_TMOUT; + case CORE_MESSAGE_QUEUE_STATUS_INVALID_SIZE: + return E_PAR; + case CORE_MESSAGE_QUEUE_STATUS_UNSATISFIED_NOWAIT: + return E_TMOUT; + case CORE_MESSAGE_QUEUE_STATUS_TIMEOUT: + return E_TMOUT; + default: + return E_ID; + } +} + +/* + * _ITRON_Message_buffer_Manager_initialization + * + * This routine initializes all message buffer manager related data + * structures. + * + * Input parameters: + * maximum_message_buffers - maximum configured message buffers + * + * Output parameters: NONE + */ + +void _ITRON_Message_buffer_Manager_initialization( + unsigned32 maximum_message_buffers + ) +{ + _Objects_Initialize_information( + &_ITRON_Message_buffer_Information, /* object information table */ + OBJECTS_ITRON_MESSAGE_BUFFERS, /* object class */ + FALSE, /* TRUE if this is a + global object class */ + maximum_message_buffers, /* maximum objects of this class */ + sizeof( ITRON_Message_buffer_Control ), /* size of this + object's control + block */ + FALSE, /* TRUE if names for this + object are strings */ + RTEMS_MAXIMUM_NAME_LENGTH, /* maximum length of each + object's name */ + FALSE /* TRUE if this class is threads */ + ); + + /* + * Register the MP Process Packet routine. + * + * NOTE: No MP Support YET in RTEMS ITRON implementation. + */ + +} + +/* + * cre_mbf - Create MessageBuffer + */ + +ER cre_mbf( + ID mbfid, + T_CMBF *pk_cmbf + ) +{ + CORE_message_queue_Attributes the_message_queue_attributes; + ITRON_Message_buffer_Control *the_message_buffer; + + /* + * Bad pointer to the attributes structure + */ + + if ( !pk_cmbf ) + return E_PAR; + + /* + * Bits were set that were note defined. + */ + + if (pk_cmbf->mbfatr & ~(TA_TPRI)) + return E_RSATR; + + if (pk_cmbf->bufsz < 0 || pk_cmbf->maxmsz < 0) + return E_PAR; + + if (pk_cmbf->bufsz < pk_cmbf->maxmsz) + return E_PAR; + + _Thread_Disable_dispatch(); /* prevents deletion */ + + the_message_buffer = _ITRON_Message_buffer_Allocate(mbfid); + if ( !the_message_buffer ) { + _Thread_Enable_dispatch(); + return _ITRON_Message_buffer_Clarify_allocation_id_error(mbfid); + } + + if ( pk_cmbf->mbfatr & TA_TPRI ) + the_message_queue_attributes.discipline = + CORE_MESSAGE_QUEUE_DISCIPLINES_PRIORITY; + else + the_message_queue_attributes.discipline = + CORE_MESSAGE_QUEUE_DISCIPLINES_FIFO; + + _CORE_message_queue_Initialize( + &the_message_buffer->message_queue, + OBJECTS_ITRON_MESSAGE_BUFFERS, + &the_message_queue_attributes, + pk_cmbf->bufsz / pk_cmbf->maxmsz, + pk_cmbf->maxmsz, + NULL /* Multiprocessing not supported */ + ); + + _ITRON_Objects_Open( &_ITRON_Message_buffer_Information, + &the_message_buffer->Object ); + + /* + * If multiprocessing were supported, this is where we would announce + * the existence of the semaphore to the rest of the system. + */ + +#if defined(RTEMS_MULTIPROCESSING) +#endif + + _Thread_Enable_dispatch(); + + return E_OK; +} + +/* + * del_mbf - Delete MessageBuffer + */ + +ER del_mbf( + ID mbfid + ) +{ + ITRON_Message_buffer_Control *the_message_buffer; + Objects_Locations location; + + the_message_buffer = _ITRON_Message_buffer_Get(mbfid, &location); + + switch (location) { + case OBJECTS_REMOTE: + case OBJECTS_ERROR: /* Multiprocessing not supported */ + return _ITRON_Message_buffer_Clarify_get_id_error(mbfid); + + case OBJECTS_LOCAL: + _CORE_message_queue_Flush(&the_message_buffer->message_queue); + _ITRON_Objects_Close( + &_ITRON_Message_buffer_Information, + &the_message_buffer->Object); + _ITRON_Message_buffer_Free(the_message_buffer); + /* + * If multiprocessing were supported, this is where we would announce + * the existence of the semaphore to the rest of the system. + */ + +#if defined(RTEMS_MULTIPROCESSING) +#endif + _Thread_Enable_dispatch(); + return E_OK; + } + + return E_OK; +} + +/* + * snd_mbf - Send Message to MessageBuffer + */ + +ER snd_mbf( + ID mbfid, + VP msg, + INT msgsz + ) +{ + return E_OK; +} + +/* + * psnd_mbf - Poll and Send Message to MessageBuffer + */ + +ER psnd_mbf( + ID mbfid, + VP msg, + INT msgsz + ) +{ + ITRON_Message_buffer_Control *the_message_buffer; + Objects_Locations location; + CORE_message_queue_Status status; + + if (msgsz <= 0 || !msg) + return E_PAR; + + the_message_buffer = _ITRON_Message_buffer_Get(mbfid, &location); + switch (location) { + case OBJECTS_REMOTE: + case OBJECTS_ERROR: /* Multiprocessing not supported */ + return _ITRON_Message_buffer_Clarify_get_id_error(mbfid); + + case OBJECTS_LOCAL: + status = _CORE_message_queue_Submit( + &the_message_buffer->message_queue, + msg, + msgsz, + the_message_buffer->Object.id, + NULL, + CORE_MESSAGE_QUEUE_SEND_REQUEST); + _Thread_Enable_dispatch(); + return + _ITRON_Message_buffer_Translate_core_message_buffer_return_code( + status); + } + + /* + * If multiprocessing were supported, this is where we would announce + * the existence of the semaphore to the rest of the system. + */ + +#if defined(RTEMS_MULTIPROCESSING) +#endif + + return E_OK; +} + +/* + * tsnd_mbf - Send Message to MessageBuffer with Timeout + */ + +ER tsnd_mbf( + ID mbfid, + VP msg, + INT msgsz, + TMO tmout + ) +{ + return E_OK; +} + +/* + * rcv_mbf - Receive Message from MessageBuffer + */ + +ER rcv_mbf( + VP msg, + INT *p_msgsz, + ID mbfid + ) +{ + return trcv_mbf(msg, p_msgsz, mbfid, TMO_FEVR); +} + +/* + * prcv_mbf - Poll and Receive Message from MessageBuffer + */ + +ER prcv_mbf( + VP msg, + INT *p_msgsz, + ID mbfid + ) +{ + return trcv_mbf(msg, p_msgsz, mbfid, TMO_POL); +} + +/* + * trcv_mbf - Receive Message from MessageBuffer with Timeout + */ + +ER trcv_mbf( + VP msg, + INT *p_msgsz, + ID mbfid, + TMO tmout + ) +{ + ITRON_Message_buffer_Control *the_message_buffer; + Objects_Locations location; + CORE_message_queue_Status status; + boolean wait; + Watchdog_Interval interval; + + interval = 0; + if (tmout == TMO_POL) { + wait = FALSE; + } else { + wait = TRUE; + if (tmout != TMO_FEVR) + interval = TOD_MILLISECONDS_TO_TICKS(tmout); + } + + if (wait && _ITRON_Is_in_non_task_state() ) + return E_CTX; + + if (!p_msgsz || !msg || tmout <= -2) + return E_PAR; + + the_message_buffer = _ITRON_Message_buffer_Get(mbfid, &location); + switch (location) { + case OBJECTS_REMOTE: + case OBJECTS_ERROR: /* Multiprocessing not supported */ + return _ITRON_Message_buffer_Clarify_get_id_error(mbfid); + + case OBJECTS_LOCAL: + _CORE_message_queue_Seize( + &the_message_buffer->message_queue, + the_message_buffer->Object.id, + msg, + p_msgsz, + wait, + interval); + _Thread_Enable_dispatch(); + status = + (CORE_message_queue_Status)_Thread_Executing->Wait.return_code; + return + _ITRON_Message_buffer_Translate_core_message_buffer_return_code + (status); + + } + + /* + * If multiprocessing were supported, this is where we would announce + * the existence of the semaphore to the rest of the system. + */ + +#if defined(RTEMS_MULTIPROCESSING) +#endif + return E_OK; +} + +/* + * ref_mbf - Reference MessageBuffer Status + */ + +ER ref_mbf( + T_RMBF *pk_rmbf, + ID mbfid + ) +{ + ITRON_Message_buffer_Control *the_message_buffer; + Objects_Locations location; + + if ( !pk_rmbf ) + return E_PAR; /* XXX check this error code */ + + the_message_buffer = _ITRON_Message_buffer_Get( mbfid, &location ); + switch ( location ) { + case OBJECTS_REMOTE: /* Multiprocessing not supported */ + case OBJECTS_ERROR: + return _ITRON_Message_buffer_Clarify_get_id_error( mbfid ); + + case OBJECTS_LOCAL: + /* + * Fill in the size of message to be sent + */ + + if(the_message_buffer->message_queue. + number_of_pending_messages == 0) { + pk_rmbf->msgsz = 0; + } + else { + CORE_message_queue_Buffer_control *the_message; + the_message = (CORE_message_queue_Buffer_control*) + the_message_buffer->message_queue. + Pending_messages.first; + pk_rmbf->msgsz = the_message->Contents.size; + } + + /* + * Fill in the size of free buffer + */ + + pk_rmbf->frbufsz = + (the_message_buffer->message_queue.maximum_pending_messages- + the_message_buffer->message_queue.number_of_pending_messages)* + the_message_buffer->message_queue.maximum_message_size; + + + /* + * Fill in whether or not there is a waiting task + */ + + if ( !_Thread_queue_First( + &the_message_buffer->message_queue.Wait_queue ) ) + pk_rmbf->wtsk = FALSE; + else + pk_rmbf->wtsk = TRUE; + + pk_rmbf->stsk = FALSE; + _Thread_Enable_dispatch(); + return E_OK; + } + return E_OK; +} diff --git a/cpukit/itron/src/network.c b/cpukit/itron/src/network.c new file mode 100644 index 0000000000..82a57ac1a1 --- /dev/null +++ b/cpukit/itron/src/network.c @@ -0,0 +1,65 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include + +/* + * nrea_dat - Read Data from another Node + */ + +ER nrea_dat( + INT *p_reasz, + VP dstadr, + NODE srcnode, + VP srcadr, + INT datsz +) +{ + return E_OK; +} + +/* + * nwri_dat - Write Data to another Node + */ + +ER nwri_dat( + INT *p_wrisz, + NODE dstnode, + VP dstadr, + VP srcadr, + INT datsz +) +{ + return E_OK; +} + +/* + * nget_nod - Get Local Node Number + */ + +ER nget_nod( + NODE *p_node +) +{ + return E_OK; +} + +/* + * nget_ver - Get Version Information of another Node + */ + +ER nget_ver( + T_VER *pk_ver, + NODE node +) +{ + return E_OK; +} + diff --git a/cpukit/itron/src/port.c b/cpukit/itron/src/port.c new file mode 100644 index 0000000000..4d95638f7b --- /dev/null +++ b/cpukit/itron/src/port.c @@ -0,0 +1,202 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include + +/* + * _ITRON_Port_Manager_initialization + * + * This routine initializes all ports manager related data structures. + * + * Input parameters: + * maximum_ports - maximum configured ports + * + * Output parameters: NONE + */ + +void _ITRON_Port_Manager_initialization( + unsigned32 maximum_ports +) +{ + _Objects_Initialize_information( + &_ITRON_Port_Information, /* object information table */ + OBJECTS_ITRON_PORTS, /* object class */ + FALSE, /* TRUE if this is a global object class */ + maximum_ports, /* maximum objects of this class */ + sizeof( ITRON_Port_Control ), /* size of this object's control block */ + FALSE, /* TRUE if names for this object */ + /* are strings */ + RTEMS_MAXIMUM_NAME_LENGTH, /* maximum length of each object's name */ + FALSE /* TRUE if this class is threads */ + ); + + /* + * Register the MP Process Packet routine. + * + * NOTE: No MP Support YET in RTEMS ITRON implementation. + */ + +} + +/* + * cre_por - Create Port for Rendezvous + */ + +ER cre_por( + ID porid, + T_CPOR *pk_cpor +) +{ + return E_OK; +} + +/* + * del_por - Delete Port for Rendezvous + */ + +ER del_por( + ID porid +) +{ + return E_OK; +} + +/* + * cal_por - Call Port for Rendezvous Poll + */ + +ER cal_por( + VP msg, + INT *p_rmsgsz, + ID porid, + UINT calptn, + INT cmsgsz +) +{ + return E_OK; +} + +/* + * pcal_por - Poll and Call Port for Rendezvous + */ + +ER pcal_por( + VP msg, + INT *p_rmsgsz, + ID porid, + UINT calptn, + INT cmsgsz +) +{ + return E_OK; +} + +/* + * tcal_por - Call Port for Rendezvous with Timeout + */ + +ER tcal_por( + VP msg, + INT *p_rmsgsz, + ID porid, + UINT calptn, + INT cmsgsz, + TMO tmout +) +{ + return E_OK; +} + +/* + * acp_por - Accept Port for Rendezvous Poll + */ + +ER acp_por( + RNO *p_rdvno, + VP msg, + INT *p_cmsgsz, + ID porid, + UINT acpptn +) +{ + return E_OK; +} + +/* + * pacp_por - Poll and Accept Port for Rendezvous + */ + +ER pacp_por( + RNO *p_rdvno, + VP msg, + INT *p_cmsgsz, + ID porid, + UINT acpptn +) +{ + return E_OK; +} + +/* + * tacp_por - Accept Port for Rendezvous with Timeout + */ + +ER tacp_por( + RNO *p_rdvno, + VP msg, + INT *p_cmsgsz, + ID porid, + UINT acpptn, + TMO tmout +) +{ + return E_OK; +} + +/* + * fwd_por - Forward Rendezvous to Other Port + */ + +ER fwd_por( + ID porid, + UINT calptn, + RNO rdvno, + VP msg, + INT cmsgsz +) +{ + return E_OK; +} + +/* + * rpl_rdv - Reply Rendezvous + */ + +ER rpl_rdv( + RNO rdvno, + VP msg, + INT rmsgsz +) +{ + return E_OK; +} + +/* + * ref_por - Reference Port Status + */ + +ER ref_por( + T_RPOR *pk_rpor, + ID porid +) +{ + return E_OK; +} + diff --git a/cpukit/itron/src/ref_tsk.c b/cpukit/itron/src/ref_tsk.c new file mode 100644 index 0000000000..50ce76e8ed --- /dev/null +++ b/cpukit/itron/src/ref_tsk.c @@ -0,0 +1,31 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + + +/* + * ref_tsk - Reference Task Status + */ + +ER ref_tsk( + T_RTSK *pk_rtsk, + ID tskid +) +{ + return E_OK; +} + diff --git a/cpukit/itron/src/rel_wai.c b/cpukit/itron/src/rel_wai.c new file mode 100644 index 0000000000..390433ec0c --- /dev/null +++ b/cpukit/itron/src/rel_wai.c @@ -0,0 +1,30 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + +/* + * rel_wai - Release Wait of Other Task + */ + +ER rel_wai( + ID tskid +) +{ + return E_OK; +} + + diff --git a/cpukit/itron/src/rot_rdq.c b/cpukit/itron/src/rot_rdq.c new file mode 100644 index 0000000000..b329313946 --- /dev/null +++ b/cpukit/itron/src/rot_rdq.c @@ -0,0 +1,30 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + +/* + * rot_rdq - Rotate Tasks on the Ready Queue + */ + +ER rot_rdq( + PRI tskpri +) +{ + return E_OK; +} + + diff --git a/cpukit/itron/src/rsm_tsk.c b/cpukit/itron/src/rsm_tsk.c new file mode 100644 index 0000000000..a19842f8da --- /dev/null +++ b/cpukit/itron/src/rsm_tsk.c @@ -0,0 +1,30 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + + +/* + * rsm_tsk - Resume Suspended Task + */ + +ER rsm_tsk( + ID tskid +) +{ + return E_OK; +} + diff --git a/cpukit/itron/src/slp_tsk.c b/cpukit/itron/src/slp_tsk.c new file mode 100644 index 0000000000..00562dda92 --- /dev/null +++ b/cpukit/itron/src/slp_tsk.c @@ -0,0 +1,28 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + + + +/* + * slp_tsk - Sleep Task Sleep Task with Timeout + */ + +ER slp_tsk( void ) +{ + return E_OK; +} diff --git a/cpukit/itron/src/sta_tsk.c b/cpukit/itron/src/sta_tsk.c new file mode 100644 index 0000000000..91a6586c0e --- /dev/null +++ b/cpukit/itron/src/sta_tsk.c @@ -0,0 +1,84 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + + +/* + * sta_tsk - Start Task + */ + +/* + * XXX - How Do I know when these happen ??? + E_NOEXS Object does not exist (the task specified by tskid does not exist) + E_OACV Object access violation (A tskid less than -4 was specified from + a user task. This is implementation dependent.) + E_OBJ Invalid object state (the target task is not in DORMANT state) + EN_OBJNO An object number which could not be accessed on the target node + is specified. XXX Should never get on a single processor?? + EN_CTXID Specified an object on another node when the system call was + issued from a task in dispatch disabled state or from a task- + independent portionXXX Should never get on a single processor?? + EN_PAR A value outside the range supported by the target node and/or + transmission packet format was specified as a parameter (a value + outside supported range was specified for stacd) +XXX- What does _ITRON_Task_Get return on an invalid id and how do you know + if it is E_ID, E_NOEXS, E_OACV +*/ + +ER sta_tsk( + ID tskid, + INT stacd +) +{ + register Thread_Control *the_thread; + Objects_Locations location; + boolean status; + + the_thread = _ITRON_Task_Get( tskid, &location ); + switch ( location ) { + case OBJECTS_REMOTE: + case OBJECTS_ERROR: + return E_ID; /* XXX */ + + case OBJECTS_LOCAL: + status = _Thread_Start( + the_thread, + THREAD_START_NUMERIC, /* XXX should be able to say we have no arg */ + the_thread->Start.entry_point, + 0, /* XXX supercore forces us to have an arg */ + 0 /* unused */ + ); + + /* + * Wrong state XXX + */ + + if ( !status ) { + _Thread_Enable_dispatch(); + return E_OBJ; + } + + _Thread_Enable_dispatch(); + return E_OK; + } + + return E_OBJ; /* unreached - only to remove warnings */ +} + + + + diff --git a/cpukit/itron/src/sus_tsk.c b/cpukit/itron/src/sus_tsk.c new file mode 100644 index 0000000000..f4a5d5b851 --- /dev/null +++ b/cpukit/itron/src/sus_tsk.c @@ -0,0 +1,34 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + + +/* + * Task-Dependent Synchronization Functions + */ + +/* + * sus_tsk - Suspend Other Task + */ + +ER sus_tsk( + ID tskid +) +{ + return E_OK; +} + diff --git a/cpukit/itron/src/sysmgmt.c b/cpukit/itron/src/sysmgmt.c new file mode 100644 index 0000000000..24d9075154 --- /dev/null +++ b/cpukit/itron/src/sysmgmt.c @@ -0,0 +1,69 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include + +/* + * get_ver - Get Version Information + */ + +ER get_ver( + T_VER *pk_ver +) +{ + return E_OK; +} + +/* + * ref_sys - Reference System Status + */ + +ER ref_sys( + T_RSYS *pk_rsys +) +{ + return E_OK; +} + +/* + * ref_cfg - Reference Configuration Information + */ + +ER ref_cfg( + T_RCFG *pk_rcfg +) +{ + return E_OK; +} + +/* + * def_svc - Define Extended SVC Handler + */ + +ER def_svc( + FN s_fncd, + T_DSVC *pk_dsvc +) +{ + return E_OK; +} + +/* + * def_exc - Define Exception Handler + */ + +ER def_exc( + UINT exckind, + T_DEXC *pk_dexc +) +{ + return E_OK; +} + diff --git a/cpukit/itron/src/task.c b/cpukit/itron/src/task.c new file mode 100644 index 0000000000..f646b29d49 --- /dev/null +++ b/cpukit/itron/src/task.c @@ -0,0 +1,217 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + +/* + * _ITRON_Task_Create_extension + * + * This routine is an extension routine that is invoked as part + * of creating any type of task or thread in the system. If the + * task is created via another API, then this routine is invoked + * and this API given the opportunity to initialize its extension + * area. + */ + +boolean _ITRON_Task_Create_extension( + Thread_Control *executing, + Thread_Control *created +) +{ + ITRON_API_Control *api; + + api = _Workspace_Allocate( sizeof( ITRON_API_Control ) ); + + if ( !api ) + return FALSE; + + created->API_Extensions[ THREAD_API_ITRON ] = api; + + /* + * Initialize the ITRON API extension + */ + + return TRUE; +} + +/* + * _ITRON_Task_Delete_extension + * + * This extension routine is invoked when a task is deleted. + */ + +User_extensions_routine _ITRON_Task_Delete_extension( + Thread_Control *executing, + Thread_Control *deleted +) +{ + (void) _Workspace_Free( deleted->API_Extensions[ THREAD_API_ITRON ] ); + + deleted->API_Extensions[ THREAD_API_ITRON ] = NULL; +} + +/* + * _ITRON_Task_Initialize_user_tasks + * + * This routine creates and starts all configured user + * initialzation threads. + */ + +void _ITRON_Task_Initialize_user_tasks( void ) +{ + unsigned32 index; + unsigned32 maximum; + ER return_value; + itron_initialization_tasks_table *user_tasks; + + /* + * NOTE: This is slightly different from the Ada implementation. + */ + + user_tasks = _ITRON_Task_User_initialization_tasks; + maximum = _ITRON_Task_Number_of_initialization_tasks; + + if ( !user_tasks || maximum == 0 ) + return; + + for ( index=0 ; index < maximum ; index++ ) { + + return_value = cre_tsk( + user_tasks[ index ].id, + &user_tasks[ index ].attributes + ); + + if ( return_value != E_OK ) + _Internal_error_Occurred( INTERNAL_ERROR_ITRON_API, TRUE, return_value ); + + return_value = sta_tsk( user_tasks[ index ].id, 0 ); + + if ( return_value != E_OK ) + _Internal_error_Occurred( INTERNAL_ERROR_ITRON_API, TRUE, return_value ); + + } +} + +/*PAGE + * + * _ITRON_Delete_task + */ + +ER _ITRON_Delete_task( + Thread_Control *the_thread +) +{ + Objects_Information *the_information; + + the_information = _Objects_Get_information( the_thread->Object.id ); + + if ( !the_information ) { + return -1; /* XXX */ + /* This should never happen if _Thread_Get() works right */ + } + + _Thread_Close( the_information, the_thread ); + + _ITRON_Task_Free( the_thread ); + + return E_OK; +} + +/* + * At this point in time, the ITRON API does not need any other + * extensions. See the POSIX and RTEMS API extensions for + * examples of how they can be used. + */ + +/* + * Extension Tables + */ + +API_extensions_Control _ITRON_Task_API_extensions = { + { NULL, NULL }, + NULL, /* predriver */ + _ITRON_Task_Initialize_user_tasks, /* postdriver */ + NULL /* post switch */ +}; + +User_extensions_Control _ITRON_Task_User_extensions = { + { NULL, NULL }, + { _ITRON_Task_Create_extension, /* create */ + NULL, /* start */ + NULL, /* restart */ + _ITRON_Task_Delete_extension, /* delete */ + NULL, /* switch */ + NULL, /* begin */ + NULL, /* exitted */ + NULL /* fatal */ + } +}; + +/* + * _ITRON_Task_Manager_initialization + * + * This routine initializes all Task Manager related data structures. + * + * Input parameters: + * maximum_tasks - number of tasks to initialize + * + * Output parameters: NONE + */ + +void _ITRON_Task_Manager_initialization( + unsigned32 maximum_tasks, + unsigned32 number_of_initialization_tasks, + itron_initialization_tasks_table *user_tasks +) +{ + + _ITRON_Task_Number_of_initialization_tasks = number_of_initialization_tasks; + _ITRON_Task_User_initialization_tasks = user_tasks; + + /* + * There may not be any ITRON_initialization tasks configured. + */ + +#if 0 + if ( user_tasks == NULL || number_of_initialization_tasks == 0 ) + _Internal_error_Occurred( INTERNAL_ERROR_ITRON_API, TRUE, -1 ); +#endif + + _Objects_Initialize_information( + &_ITRON_Task_Information, /* object information table */ + OBJECTS_ITRON_TASKS, /* object class */ + FALSE, /* TRUE if this is a global object class */ + maximum_tasks, /* maximum objects of this class */ + sizeof( Thread_Control ), /* size of this object's control block */ + FALSE, /* TRUE if names for this object are strings */ + ITRON_MAXIMUM_NAME_LENGTH, /* maximum length of each object's name */ + TRUE /* TRUE if this class is threads */ + ); + + /* + * Add all the extensions for this API + */ + + _User_extensions_Add_API_set( &_ITRON_Task_User_extensions ); + + _API_extensions_Add( &_ITRON_Task_API_extensions ); + + /* + * XXX MP not supported + * Register the MP Process Packet routine. + */ + +} diff --git a/cpukit/itron/src/ter_tsk.c b/cpukit/itron/src/ter_tsk.c new file mode 100644 index 0000000000..c0d05c1fec --- /dev/null +++ b/cpukit/itron/src/ter_tsk.c @@ -0,0 +1,30 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + + +/* + * ter_tsk - Terminate Other Task + */ + +ER ter_tsk( + ID tskid +) +{ + return E_OK; +} + diff --git a/cpukit/itron/src/tslp_tsk.c b/cpukit/itron/src/tslp_tsk.c new file mode 100644 index 0000000000..b8556f0f68 --- /dev/null +++ b/cpukit/itron/src/tslp_tsk.c @@ -0,0 +1,31 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + + +/* + * tslp_tsk - Sleep Task with Timeout + */ + +ER tslp_tsk( + TMO tmout +) +{ + return E_OK; +} + + diff --git a/cpukit/itron/src/vmempool.c b/cpukit/itron/src/vmempool.c new file mode 100644 index 0000000000..726d9c8c68 --- /dev/null +++ b/cpukit/itron/src/vmempool.c @@ -0,0 +1,138 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include + +/* + * _ITRON_Variable_memory_pool_Manager_initialization + * + * This routine initializes all variable memory pool manager related + * data structures. + * + * Input parameters: + * maximum_variable_memory_pools - maximum configured variable memory pools + * + * Output parameters: NONE + */ + +void _ITRON_Variable_memory_pool_Manager_initialization( + unsigned32 maximum_variable_memory_pools +) +{ + _Objects_Initialize_information( + &_ITRON_Variable_memory_pool_Information, /* object information table */ + OBJECTS_ITRON_VARIABLE_MEMORY_POOLS, /* object class */ + FALSE, /* TRUE if this is a global */ + /* object class */ + maximum_variable_memory_pools, /* maximum objects of this class */ + sizeof( ITRON_Variable_memory_pool_Control ), + /* size of this object's control block */ + FALSE, /* TRUE if names for this object */ + /* are strings */ + RTEMS_MAXIMUM_NAME_LENGTH, /* maximum length of each object's */ + /* name */ + FALSE /* TRUE if this class is threads */ + ); + + /* + * Register the MP Process Packet routine. + * + * NOTE: No MP Support YET in RTEMS ITRON implementation. + */ + +} + +/* + * cre_mpl - Create Variable-Size Memorypool + */ + +ER cre_mpl( + ID mplid, + T_CMPL *pk_cmpl +) +{ + return E_OK; +} + +/* + * del_mpl - Delete Variable-Size Memorypool + */ + +ER del_mpl( + ID mplid +) +{ + return E_OK; +} + +/* + * get_blk - Get Variable-Size Memory Block + */ + +ER get_blk( + VP *p_blk, + ID mplid, + INT blksz +) +{ + return E_OK; +} + +/* + * pget_blk - Poll and Get Variable-Size Memory Block + */ + +ER pget_blk( + VP *p_blk, + ID mplid, + INT blksz +) +{ + return E_OK; +} + +/* + * tget_blk - Get Variable-Size Memory Block with Timeout + */ + +ER tget_blk( + VP *p_blk, + ID mplid, + INT blksz, + TMO tmout +) +{ + return E_OK; +} + +/* + * rel_blk - Release Variable-Size Memory Block + */ + +ER rel_blk( + ID mplid, + VP blk +) +{ + return E_OK; +} + +/* + * ref_mpl - Reference Variable-Size Memorypool Status + */ + +ER ref_mpl( + T_RMPL *pk_rmpl, + ID mplid +) +{ + return E_OK; +} + diff --git a/cpukit/itron/src/wup_tsk.c b/cpukit/itron/src/wup_tsk.c new file mode 100644 index 0000000000..bc0ca0edb9 --- /dev/null +++ b/cpukit/itron/src/wup_tsk.c @@ -0,0 +1,30 @@ +/* + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include + +#include + + +/* + * wup_tsk - Wakeup Other Task + */ + +ER wup_tsk( + ID tskid +) +{ + return E_OK; +} + diff --git a/cpukit/posix/Makefile.am b/cpukit/posix/Makefile.am index a3204d5b9c..6de0e0c27e 100644 --- a/cpukit/posix/Makefile.am +++ b/cpukit/posix/Makefile.am @@ -5,7 +5,7 @@ AUTOMAKE_OPTIONS = foreign 1.4 ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal -SUBDIRS = include inline macros optman src +SUBDIRS = include inline macros src include $(top_srcdir)/../../../../automake/subdirs.am include $(top_srcdir)/../../../../automake/local.am diff --git a/cpukit/sapi/include/confdefs.h b/cpukit/sapi/include/confdefs.h index e2a0c84d3d..152ae790df 100644 --- a/cpukit/sapi/include/confdefs.h +++ b/cpukit/sapi/include/confdefs.h @@ -29,6 +29,9 @@ extern rtems_multiprocessing_table Multiprocessing_configuration; #ifdef RTEMS_POSIX_API extern posix_api_configuration_table Configuration_POSIX_API; #endif +#ifdef RTEMS_ITRON_API +extern itron_api_configuration_table Configuration_ITRON_API; +#endif /* * RTEMS C Library and Newlib support @@ -508,6 +511,184 @@ posix_initialization_threads_table POSIX_Initialization_threads[] = { #define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE 0 #endif +/* + * ITRON API Configuration Parameters + */ + +#ifdef RTEMS_ITRON_API + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef CONFIGURE_MAXIMUM_ITRON_TASKS +#define CONFIGURE_MAXIMUM_ITRON_TASKS 10 +#endif + +#ifndef CONFIGURE_MAXIMUM_ITRON_SEMAPHORES +#define CONFIGURE_MAXIMUM_ITRON_SEMAPHORES 0 +#endif + +#ifndef CONFIGURE_MAXIMUM_ITRON_EVENTFLAGS +#define CONFIGURE_MAXIMUM_ITRON_EVENTFLAGS 0 +#endif + +#ifndef CONFIGURE_MAXIMUM_ITRON_MAILBOXES +#define CONFIGURE_MAXIMUM_ITRON_MAILBOXES 0 +#endif + +#ifndef CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS +#define CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS 0 +#endif + +#ifndef CONFIGURE_MAXIMUM_ITRON_PORTS +#define CONFIGURE_MAXIMUM_ITRON_PORTS 0 +#endif + +#ifndef CONFIGURE_MAXIMUM_ITRON_MEMORY_POOLS +#define CONFIGURE_MAXIMUM_ITRON_MEMORY_POOLS 0 +#endif + +#ifndef CONFIGURE_MAXIMUM_ITRON_FIXED_MEMORY_POOLS +#define CONFIGURE_MAXIMUM_ITRON_FIXED_MEMORY_POOLS 0 +#endif + +#ifdef CONFIGURE_ITRON_INIT_TASK_TABLE + +#ifdef CONFIGURE_ITRON_HAS_OWN_INIT_TASK_TABLE + +/* + * The user is defining their own table information and setting the + * appropriate variables. + */ + +#else + +#ifndef CONFIGURE_ITRON_INIT_TASK_ENTRY_POINT +#define CONFIGURE_ITRON_INIT_TASK_ENTRY_POINT ITRON_Init +#endif + +#ifndef CONFIGURE_ITRON_INIT_TASK_ATTRIBUTES +#define CONFIGURE_ITRON_INIT_TASK_ATTRIBUTES TA_HLNG +#endif + +#ifndef CONFIGURE_ITRON_INIT_TASK_PRIORITY +#define CONFIGURE_ITRON_INIT_TASK_PRIORITY 1 +#endif + +#ifndef CONFIGURE_ITRON_INIT_TASK_STACK_SIZE +#define CONFIGURE_ITRON_INIT_TASK_STACK_SIZE RTEMS_MINIMUM_STACK_SIZE +#endif + +#ifdef CONFIGURE_INIT +itron_initialization_tasks_table ITRON_Initialization_tasks[] = { + { 1, /* ID */ + { (VP) 0, /* exinfo */ + CONFIGURE_ITRON_INIT_TASK_ATTRIBUTES, /* task attributes */ + CONFIGURE_ITRON_INIT_TASK_ENTRY_POINT, /* task start address */ + CONFIGURE_ITRON_INIT_TASK_PRIORITY, /* initial task priority */ + CONFIGURE_ITRON_INIT_TASK_STACK_SIZE /* stack size */ + } + } +}; +#endif + +#define CONFIGURE_ITRON_INIT_TASK_TABLE_NAME ITRON_Initialization_tasks + +#define CONFIGURE_ITRON_INIT_TASK_TABLE_SIZE \ + sizeof(CONFIGURE_ITRON_INIT_TASK_TABLE_NAME) / \ + sizeof(itron_initialization_tasks_table) + +#endif /* CONFIGURE_ITRON_HAS_OWN_INIT_TASK_TABLE */ + +#else /* CONFIGURE_ITRON_INIT_TASK_TABLE */ + +#define CONFIGURE_ITRON_INIT_TASK_TABLE_NAME NULL +#define CONFIGURE_ITRON_INIT_TASK_TABLE_SIZE 0 + +#endif + +#define CONFIGURE_MEMORY_PER_TASK_FOR_ITRON_API \ + ( \ + sizeof (ITRON_API_Control) \ + ) + +#define CONFIGURE_MEMORY_FOR_ITRON_SEMAPHORES(_semaphores) \ + ((_semaphores) * \ + ( sizeof(ITRON_Semaphore_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) ) + +#define CONFIGURE_MEMORY_FOR_ITRON_EVENTFLAGS(_eventflags) \ + ((_eventflags) * \ + ( sizeof(ITRON_Eventflags_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) ) + +#define CONFIGURE_MEMORY_FOR_ITRON_MAILBOXES(_mailboxes) \ + ((_mailboxes) * \ + ( sizeof(ITRON_Mailbox_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) ) + +#define CONFIGURE_MEMORY_FOR_ITRON_MESSAGE_BUFFERS(_message_buffers) \ + ((_message_buffers) * \ + ( sizeof(ITRON_Message_buffer_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) ) + +#define CONFIGURE_MEMORY_FOR_ITRON_PORTS(_ports) \ + ((_ports) * \ + ( sizeof(ITRON_Port_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) ) + +#define CONFIGURE_MEMORY_FOR_ITRON_MEMORY_POOLS(_memory_pools) \ + ((_memory_pools) * \ + (sizeof(ITRON_Variable_memory_pool_Control) + CONFIGURE_OBJECT_TABLE_STUFF)) + +#define CONFIGURE_MEMORY_FOR_ITRON_FIXED_MEMORY_POOLS(_fixed_memory_pools) \ + ((_fixed_memory_pools) * \ + ( sizeof(ITRON_Fixed_memory_pool_Control) + CONFIGURE_OBJECT_TABLE_STUFF ) ) + +#ifndef CONFIGURE_ITRON_INIT_TASK_STACK_SIZES +#define CONFIGURE_ITRON_INIT_TASK_STACK_SIZES (RTEMS_MINIMUM_STACK_SIZE * 2) +#endif + + +#define CONFIGURE_MEMORY_FOR_ITRON \ + ( \ + CONFIGURE_MEMORY_FOR_ITRON_SEMAPHORES( \ + CONFIGURE_MAXIMUM_ITRON_SEMAPHORES ) + \ + CONFIGURE_MEMORY_FOR_ITRON_EVENTFLAGS( \ + CONFIGURE_MAXIMUM_ITRON_EVENTFLAGS ) + \ + CONFIGURE_MEMORY_FOR_ITRON_MAILBOXES( \ + CONFIGURE_MAXIMUM_ITRON_MAILBOXES ) + \ + CONFIGURE_MEMORY_FOR_ITRON_MESSAGE_BUFFERS( \ + CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS ) + \ + CONFIGURE_MEMORY_FOR_ITRON_PORTS( \ + CONFIGURE_MAXIMUM_ITRON_PORTS ) + \ + CONFIGURE_MEMORY_FOR_ITRON_MEMORY_POOLS( \ + CONFIGURE_MAXIMUM_ITRON_MEMORY_POOLS ) + \ + CONFIGURE_MEMORY_FOR_ITRON_FIXED_MEMORY_POOLS( \ + CONFIGURE_MAXIMUM_ITRON_FIXED_MEMORY_POOLS ) + \ + CONFIGURE_ITRON_INIT_TASK_STACK_SIZES \ + ) + + +#else + +#define CONFIGURE_MAXIMUM_ITRON_TASKS 0 +#define CONFIGURE_MAXIMUM_ITRON_SEMAPHORES 0 +#define CONFIGURE_MAXIMUM_ITRON_EVENTFLAGS 0 +#define CONFIGURE_MAXIMUM_ITRON_MAILBOXES 0 +#define CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS 0 +#define CONFIGURE_MAXIMUM_ITRON_PORTS 0 +#define CONFIGURE_MAXIMUM_ITRON_MEMORY_POOLS 0 +#define CONFIGURE_MAXIMUM_ITRON_FIXED_MEMORY_POOLS 0 +#define CONFIGURE_MEMORY_PER_TASK_FOR_ITRON_API 0 +#define CONFIGURE_MEMORY_FOR_ITRON 0 + +#endif /* RTEMS_ITRON_API */ + + /* * Calculate the RAM size based on the maximum number of objects configured. * The model is to estimate the memory required for each configured item, @@ -538,6 +719,7 @@ posix_initialization_threads_table POSIX_Initialization_threads[] = { ((sizeof(Thread_Control) + CONTEXT_FP_SIZE + \ STACK_MINIMUM_SIZE + sizeof( RTEMS_API_Control ) + \ CONFIGURE_MEMORY_PER_TASK_FOR_POSIX_API + \ + CONFIGURE_MEMORY_PER_TASK_FOR_ITRON_API + \ CONFIGURE_OBJECT_TABLE_STUFF)) \ ) @@ -616,8 +798,10 @@ posix_initialization_threads_table POSIX_Initialization_threads[] = { #define CONFIGURE_EXECUTIVE_RAM_SIZE \ (( CONFIGURE_MEMORY_FOR_POSIX + \ + CONFIGURE_MEMORY_FOR_ITRON + \ CONFIGURE_MEMORY_FOR_TASKS(CONFIGURE_MAXIMUM_TASKS + \ - CONFIGURE_MAXIMUM_POSIX_THREADS + CONFIGURE_MAXIMUM_ADA_TASKS ) + \ + CONFIGURE_MAXIMUM_POSIX_THREADS + CONFIGURE_MAXIMUM_ADA_TASKS + \ + CONFIGURE_MAXIMUM_ITRON_TASKS ) + \ CONFIGURE_MEMORY_FOR_TIMERS(CONFIGURE_MAXIMUM_TIMERS) + \ CONFIGURE_MEMORY_FOR_SEMAPHORES(CONFIGURE_MAXIMUM_SEMAPHORES + \ CONFIGURE_LIBIO_SEMAPHORES) + \ @@ -697,6 +881,21 @@ posix_api_configuration_table Configuration_POSIX_API = { }; #endif +#ifdef RTEMS_ITRON_API +itron_api_configuration_table Configuration_ITRON_API = { + CONFIGURE_MAXIMUM_ITRON_TASKS, + CONFIGURE_MAXIMUM_ITRON_SEMAPHORES, + CONFIGURE_MAXIMUM_ITRON_EVENTFLAGS, + CONFIGURE_MAXIMUM_ITRON_MAILBOXES, + CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS, + CONFIGURE_MAXIMUM_ITRON_PORTS, + CONFIGURE_MAXIMUM_ITRON_MEMORY_POOLS, + CONFIGURE_MAXIMUM_ITRON_FIXED_MEMORY_POOLS, + CONFIGURE_ITRON_INIT_TASK_TABLE_SIZE, + CONFIGURE_ITRON_INIT_TASK_TABLE_NAME +}; +#endif + rtems_configuration_table Configuration = { CONFIGURE_EXECUTIVE_RAM_WORK_AREA, CONFIGURE_EXECUTIVE_RAM_SIZE, @@ -713,9 +912,14 @@ rtems_configuration_table Configuration = { CONFIGURE_MULTIPROCESSING_TABLE, /* pointer to MP config table */ &Configuration_RTEMS_API, /* pointer to RTEMS API config */ #ifdef RTEMS_POSIX_API - &Configuration_POSIX_API /* pointer to POSIX API config */ + &Configuration_POSIX_API, /* pointer to POSIX API config */ +#else + NULL, /* pointer to POSIX API config */ +#endif +#ifdef RTEMS_ITRON_API + &Configuration_ITRON_API /* pointer to ITRON API config */ #else - NULL /* pointer to POSIX API config */ + NULL /* pointer to ITRON API config */ #endif }; #endif diff --git a/cpukit/sapi/include/rtems/config.h b/cpukit/sapi/include/rtems/config.h index 7439a6e3fe..636813edc5 100644 --- a/cpukit/sapi/include/rtems/config.h +++ b/cpukit/sapi/include/rtems/config.h @@ -25,8 +25,8 @@ extern "C" { * Unlimited object support. Changes the configuration table entry for POSIX * or RTEMS APIs to bounded only by the memory of the work-space. * - * Use the macro to define the resource unlimited before placing in the configuration - * table. + * Use the macro to define the resource unlimited before placing in + * the configuration table. */ #include @@ -37,16 +37,22 @@ extern "C" { /* * This is kind of kludgy but it allows targets to totally ignore the - * POSIX API safely. + * optional APIs like POSIX and ITRON safely. */ #ifdef RTEMS_POSIX_API #include #else - typedef void *posix_api_configuration_table; #endif +#ifdef RTEMS_ITRON_API +#include +#include +#else +typedef void *itron_api_configuration_table; +#endif + #include /* XXX should cover these @@ -106,6 +112,7 @@ typedef struct { rtems_multiprocessing_table *User_multiprocessing_table; rtems_api_configuration_table *RTEMS_api_configuration; posix_api_configuration_table *POSIX_api_configuration; + itron_api_configuration_table *ITRON_api_configuration; } rtems_configuration_table; /* @@ -165,6 +172,9 @@ SAPI_EXTERN rtems_multiprocessing_table *_Configuration_MP_table; #define rtems_configuration_get_posix_api_configuration() \ (_Configuration_Table->POSIX_api_configuration) +#define rtems_configuration_get_itron_api_configuration() \ + (_Configuration_Table->ITRON_api_configuration) + #ifdef __cplusplus } #endif diff --git a/cpukit/sapi/src/exinit.c b/cpukit/sapi/src/exinit.c index 43da0a9363..511a0086f5 100644 --- a/cpukit/sapi/src/exinit.c +++ b/cpukit/sapi/src/exinit.c @@ -52,6 +52,10 @@ #ifdef RTEMS_POSIX_API #include #endif +#ifdef RTEMS_ITRON_API +#include +#endif + /*PAGE * @@ -211,6 +215,10 @@ rtems_interrupt_level rtems_initialize_executive_early( _POSIX_API_Initialize( configuration_table ); #endif +#ifdef RTEMS_ITRON_API + _ITRON_API_Initialize( configuration_table ); +#endif + _System_state_Set( SYSTEM_STATE_BEFORE_MULTITASKING ); if ( cpu_table->pretasking_hook ) diff --git a/cpukit/sapi/src/itronapi.c b/cpukit/sapi/src/itronapi.c new file mode 100644 index 0000000000..0309967ecf --- /dev/null +++ b/cpukit/sapi/src/itronapi.c @@ -0,0 +1,117 @@ +/* + * ITRON API Initialization Support + * + * NOTE: + * + * COPYRIGHT (c) 1989-1998. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +/* + * ITRON_API_INIT is defined so all of the ITRON API + * data will be included in this object file. + */ + +#define ITRON_API_INIT + +#include /* include this before checking RTEMS_ITRON_API */ +#ifdef RTEMS_ITRON_API + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +/*PAGE + * + * _ITRON_API_Initialize + * + * XXX + */ + +itron_api_configuration_table _ITRON_Default_configuration = { + 0, /* maximum_tasks */ + 0, /* maximum_semaphores */ + 0, /* maximum_eventflags */ + 0, /* maximum_mailboxes */ + 0, /* maximum_message_buffers */ + 0, /* maximum_ports */ + 0, /* maximum_memory_pools */ + 0, /* maximum_fixed_memory_pools */ + 0, /* number_of_initialization_tasks */ + NULL /* User_initialization_tasks_table */ +}; + + +void _ITRON_API_Initialize( + rtems_configuration_table *configuration_table +) +{ + itron_api_configuration_table *api_configuration; + + /* XXX need to assert here based on size assumptions */ + + assert( sizeof(ID) == sizeof(Objects_Id) ); + + api_configuration = configuration_table->ITRON_api_configuration; + if ( !api_configuration ) + api_configuration = &_ITRON_Default_configuration; + + _ITRON_Task_Manager_initialization( + api_configuration->maximum_tasks, + api_configuration->number_of_initialization_tasks, + api_configuration->User_initialization_tasks_table + ); + + _ITRON_Semaphore_Manager_initialization( + api_configuration->maximum_semaphores + ); + + _ITRON_Eventflags_Manager_initialization( + api_configuration->maximum_eventflags + ); + + _ITRON_Fixed_memory_pool_Manager_initialization( + api_configuration->maximum_fixed_memory_pools + ); + + _ITRON_Mailbox_Manager_initialization( + api_configuration->maximum_mailboxes + ); + + _ITRON_Message_buffer_Manager_initialization( + api_configuration->maximum_message_buffers + ); + + _ITRON_Port_Manager_initialization( + api_configuration->maximum_ports + ); + + _ITRON_Variable_memory_pool_Manager_initialization( + api_configuration->maximum_memory_pools + ); + + +} + +#endif +/* end of file */ diff --git a/cpukit/score/include/rtems/score/interr.h b/cpukit/score/include/rtems/score/interr.h index e999ceff7a..f3fba47f66 100644 --- a/cpukit/score/include/rtems/score/interr.h +++ b/cpukit/score/include/rtems/score/interr.h @@ -30,7 +30,8 @@ extern "C" { typedef enum { INTERNAL_ERROR_CORE, INTERNAL_ERROR_RTEMS_API, - INTERNAL_ERROR_POSIX_API + INTERNAL_ERROR_POSIX_API, + INTERNAL_ERROR_ITRON_API } Internal_errors_Source; /* diff --git a/cpukit/score/include/rtems/score/object.h b/cpukit/score/include/rtems/score/object.h index 7c72719679..9f4a6a929d 100644 --- a/cpukit/score/include/rtems/score/object.h +++ b/cpukit/score/include/rtems/score/object.h @@ -86,30 +86,38 @@ typedef unsigned32 Objects_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_NO_CLASS = 0, + OBJECTS_INTERNAL_THREADS = 1, + OBJECTS_RTEMS_TASKS = 2, + OBJECTS_POSIX_THREADS = 3, + OBJECTS_ITRON_TASKS = 4, + OBJECTS_RTEMS_TIMERS = 5, + OBJECTS_RTEMS_SEMAPHORES = 6, + OBJECTS_RTEMS_MESSAGE_QUEUES = 7, + OBJECTS_RTEMS_PARTITIONS = 8, + OBJECTS_RTEMS_REGIONS = 9, + OBJECTS_RTEMS_PORTS = 10, + OBJECTS_RTEMS_PERIODS = 11, + OBJECTS_RTEMS_EXTENSIONS = 12, + OBJECTS_POSIX_KEYS = 13, + OBJECTS_POSIX_INTERRUPTS = 14, + OBJECTS_POSIX_MESSAGE_QUEUES = 15, + OBJECTS_POSIX_MUTEXES = 16, + OBJECTS_POSIX_SEMAPHORES = 17, + OBJECTS_POSIX_CONDITION_VARIABLES = 18, + OBJECTS_ITRON_EVENTFLAGS = 19, + OBJECTS_ITRON_MAILBOXES = 20, + OBJECTS_ITRON_MESSAGE_BUFFERS = 21, + OBJECTS_ITRON_PORTS = 22, + OBJECTS_ITRON_SEMAPHORES = 23, + OBJECTS_ITRON_VARIABLE_MEMORY_POOLS = 24, + OBJECTS_ITRON_FIXED_MEMORY_POOLS = 25 } Objects_Classes; #define OBJECTS_CLASSES_FIRST OBJECTS_NO_CLASS -#define OBJECTS_CLASSES_LAST OBJECTS_POSIX_CONDITION_VARIABLES +#define OBJECTS_CLASSES_LAST OBJECTS_ITRON_FIXED_MEMORY_POOLS #define OBJECTS_CLASSES_FIRST_THREAD_CLASS OBJECTS_INTERNAL_THREADS -#define OBJECTS_CLASSES_LAST_THREAD_CLASS OBJECTS_POSIX_THREADS +#define OBJECTS_CLASSES_LAST_THREAD_CLASS OBJECTS_ITRON_TASKS /* * This enumerated type lists the locations which may be returned @@ -284,6 +292,22 @@ Objects_Control *_Objects_Allocate( Objects_Information *information ); +/* + * _Objects_Allocate_by_index + * + * DESCRIPTION: + * + * This function allocates the object control block + * specified by the index from the inactive chain of + * free object control blocks. + */ + +Objects_Control *_Objects_Allocate_by_index( + Objects_Information *information, + unsigned32 index, + unsigned32 sizeof_control +); + /*PAGE * * _Objects_Free diff --git a/cpukit/score/include/rtems/score/thread.h b/cpukit/score/include/rtems/score/thread.h index 1ca0005490..26452bffbe 100644 --- a/cpukit/score/include/rtems/score/thread.h +++ b/cpukit/score/include/rtems/score/thread.h @@ -166,11 +166,12 @@ typedef struct { typedef enum { THREAD_API_RTEMS, - THREAD_API_POSIX + THREAD_API_POSIX, + THREAD_API_ITRON } Thread_APIs; #define THREAD_API_FIRST THREAD_API_RTEMS -#define THREAD_API_LAST THREAD_API_POSIX +#define THREAD_API_LAST THREAD_API_ITRON struct Thread_Control_struct { Objects_Control Object; diff --git a/cpukit/score/include/rtems/system.h b/cpukit/score/include/rtems/system.h index 4d7f550141..423952aa56 100644 --- a/cpukit/score/include/rtems/system.h +++ b/cpukit/score/include/rtems/system.h @@ -69,6 +69,14 @@ extern "C" { #define POSIX_EXTERN extern #endif +#ifdef ITRON_API_INIT +#undef ITRON_EXTERN +#define ITRON_EXTERN +#else +#undef ITRON_EXTERN +#define ITRON_EXTERN extern +#endif + /* * The following (in conjunction with compiler arguments) are used * to choose between the use of static inline functions and macro diff --git a/cpukit/wrapup/Makefile.am b/cpukit/wrapup/Makefile.am index 7ffcb8282c..67e58c56c3 100644 --- a/cpukit/wrapup/Makefile.am +++ b/cpukit/wrapup/Makefile.am @@ -8,7 +8,11 @@ if HAS_POSIX POSIX_DIRS = posix endif -SUBDIRS = rtems $(POSIX_DIRS) +if HAS_ITRON +ITRON_DIRS = itron +endif + +SUBDIRS = rtems $(POSIX_DIRS) $(ITRON_DIRS) include $(top_srcdir)/../../../automake/subdirs.am include $(top_srcdir)/../../../automake/local.am diff --git a/testsuites/itrontests/Makefile.am b/testsuites/itrontests/Makefile.am new file mode 100644 index 0000000000..ff9e16ae5a --- /dev/null +++ b/testsuites/itrontests/Makefile.am @@ -0,0 +1,21 @@ +## +## $Id$ +## + +AUTOMAKE_OPTIONS = foreign 1.4 +ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal + +project_bspdir = $(PROJECT_ROOT)/@RTEMS_BSP@ + +PREINSTALLDIRS = $(project_bspdir)/tests/screens/psxtests +$(PREINSTALLDIRS): + @$(mkinstalldirs) $@ + +all-local: $(PREINSTALLDIRS) + +ITRON_DIRS = itronhello itrontask01 itronmbf01 itronsem01 itrontime01 + +SUBDIRS = $(ITRON_DIRS) + +include $(top_srcdir)/../../../../automake/subdirs.am +include $(top_srcdir)/../../../../automake/local.am diff --git a/testsuites/itrontests/README b/testsuites/itrontests/README new file mode 100644 index 0000000000..65c5d4165d --- /dev/null +++ b/testsuites/itrontests/README @@ -0,0 +1,6 @@ +# +# $Id$ +# + +This directory contains the functionality tests for the ITRON 3.0 API +implementation. diff --git a/testsuites/itrontests/itronhello/init.c b/testsuites/itrontests/itronhello/init.c new file mode 100644 index 0000000000..f2c079048c --- /dev/null +++ b/testsuites/itrontests/itronhello/init.c @@ -0,0 +1,30 @@ +/* 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 + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#define TEST_INIT +#include "system.h" +#include + +void ITRON_Init( void ) +{ + printf( "\n\n*** ITRON HELLO WORLD TEST ***\n" ); + printf( "Hello World\n" ); + printf( "*** END OF ITRON HELLO WORLD TEST ***\n" ); + exit( 0 ); +} diff --git a/testsuites/itrontests/itronhello/system.h b/testsuites/itrontests/itronhello/system.h new file mode 100644 index 0000000000..d7a30d195b --- /dev/null +++ b/testsuites/itrontests/itronhello/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-1998. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +/* functions */ + +void ITRON_Init( void ); + +/* configuration information */ + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER + +#define CONFIGURE_ITRON_INIT_TASK_TABLE + +#include + +/* global variables */ + +TEST_EXTERN rtems_id Global_variable; /* example global variable */ + +/* end of include file */ diff --git a/testsuites/itrontests/itronmbf01/init.c b/testsuites/itrontests/itronmbf01/init.c new file mode 100644 index 0000000000..39788c49f8 --- /dev/null +++ b/testsuites/itrontests/itronmbf01/init.c @@ -0,0 +1,362 @@ +/* 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 + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#define TEST_INIT +#include "system.h" +#include +#include + +/* + * The following is hopefully temporary. + */ + +#include + +#define put_time(_s) \ +do { \ + time_t a_time_t; \ + a_time_t = time( 0 ); \ + printf( "%s%s", _s, ctime( &a_time_t ) ); \ +} while(0) + + + +void TestCre(); +void TestDel(); +void TestPsnd(); +void TestRef(); +void TestTrcv(); +void TestRcv(); +void TestPrcv(); + +void ITRON_Init( void ) +{ + printf( "\n\n*** ITRONMBF01 -- ITRON MESSAGE BUFFER TEST ***\n" ); + + TestCre(); + TestDel(); + TestPsnd(); + TestRef(); + TestRcv(); + TestRef(); + TestPrcv(); + TestTrcv(); + + printf("\n\n*** ITRONMBF01 --- ITRON MESSAGE BUFFER TEST ***\n"); + exit(0); +} + +void TestCre() +{ + ER status; + T_CMBF pk_cmbf; + + /* + * Exercise cre_mbf - this code seems to exercise every path. + */ + + puts( "Init - cre_mbf - NULL pk_cmbf returns E_PAR" ); + status = cre_mbf( 1, NULL ); + assert( status == E_PAR ); + + puts( "Init - cre_mbf - negative values for bufsz returns E_PAR" ); + pk_cmbf.bufsz = -1; + pk_cmbf.maxmsz = 100; + status = cre_mbf( 1, &pk_cmbf ); + assert( status == E_PAR ); + + puts( "Init - cre_mbf - negative values for maxmsz returns E_PAR" ); + pk_cmbf.bufsz = 100; + pk_cmbf.maxmsz = -1; + status = cre_mbf( 1, &pk_cmbf ); + assert( status == E_PAR ); + + puts( "Init - cre_mbf - bufsz < maxmsz returns E_PAR" ); + pk_cmbf.bufsz = 100; + pk_cmbf.maxmsz = 101; + status = cre_mbf( 1, &pk_cmbf ); + assert( status == E_PAR ); + + /* + * Now run through all the bad ID errors + */ + + pk_cmbf.bufsz = 200; + pk_cmbf.maxmsz = 30; + puts( "Init - cre_mbf - bad id (less than -4) - E_OACV" ); + status = cre_mbf( -5, &pk_cmbf ); + assert( status == E_OACV ); + + puts( "Init - cre_mbf - bad id (between 0 and -4) - E_ID" ); + status = cre_mbf( -4, &pk_cmbf ); + assert( status == E_ID ); + + puts( "Init - cre_mbf - bad id (0) - E_ID" ); + status = cre_mbf( 0, &pk_cmbf ); + assert( status == E_ID ); + + puts( "Init - cre_mbf - bad id (too great) - E_ID" ); + status = cre_mbf( CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS + 1, &pk_cmbf ); + assert( status == E_ID ); + + puts( "Init - cre_mbf - create mbf 1 TA_TFIFO - E_OK" ); + pk_cmbf.bufsz = 600; + pk_cmbf.maxmsz = 200; + pk_cmbf.mbfatr = TA_TFIFO; + status = cre_mbf( 1, &pk_cmbf ); + assert( status == E_OK ); + + puts( "Init - cre_mbf - create mbf 1 again - E_OBJ" ); + status = cre_mbf( 1, &pk_cmbf ); + assert( status == E_OBJ ); + + puts( "Init - cre_mbf - create mbf 2 TA_TPRI - E_OK" ); + pk_cmbf.bufsz = 600; + pk_cmbf.maxmsz = 200; + pk_cmbf.mbfatr = TA_TPRI; + status = cre_mbf( 2, &pk_cmbf ); + assert( status == E_OK ); +} + +void TestDel() +{ + ER status; + + /* + * Generate all the bad id errors for del_mbf + */ + + puts( "Init - del_mbf - bad id (less than -4) - E_OACV" ); + status = del_mbf( -5 ); + assert( status == E_OACV ); + + puts( "Init - del_mbf - bad id (between 0 and -4) - E_ID" ); + status = del_mbf( -4 ); + assert( status == E_ID ); + + puts( "Init - del_mbf - bad id (0) - E_ID" ); + status = del_mbf( 0 ); + assert( status == E_ID ); + + puts( "Init - del_mbf - bad id (too great) - E_ID" ); + status = del_mbf( CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS + 1 ); + assert( status == E_ID ); + + + puts("Init - del_mbf - E_OK" ); + status = del_mbf(2); + assert(status == E_OK); +} + +void TestPsnd() +{ + ER status; + char msg[100] = "This is test message 1"; + + /* + * Generate all the bad id errors for psnd_mbf + */ + + puts( "Init - psnd_mbf - bad id (less than -4) - E_OACV" ); + status = psnd_mbf(-5, msg, sizeof(msg)); + assert( status == E_OACV ); + + puts( "Init - psnd_mbf - bad id (between 0 and -4) - E_ID" ); + status = psnd_mbf(-4, msg, sizeof(msg)); + assert( status == E_ID ); + + puts( "Init - psnd_mbf - bad id (0) - E_ID" ); + status = psnd_mbf(0, msg, sizeof(msg)); + assert( status == E_ID ); + + puts( "Init - psnd_mbf - bad id (too great) - E_ID" ); + status = psnd_mbf(CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS + 1, msg, + sizeof(msg)); + assert( status == E_ID ); + + puts( "Init - psnd_mbf - msg == 0, E_PAR" ); + status = psnd_mbf(1, 0, sizeof(msg)); + assert( status == E_PAR ); + + puts( "Init - psnd_mbf - msgsz too big - E_PAR" ); + status = psnd_mbf(1, msg, 300); + assert( status == E_PAR ); + + puts( "Init - psnd_mbf - msgsz <0 - E_PAR" ); + status = psnd_mbf(1, msg, -10); + assert( status == E_PAR ); + + puts( "Init - psnd_mbf - E_OK" ); + status = psnd_mbf(1, msg, sizeof(msg)); + assert( status == E_OK ); +} + +void TestRef() +{ + ER status; + T_RMBF pk_rmbf; + + puts( "Init - ref_mbf - bad id (less than -4) - E_OACV" ); + status = ref_mbf(&pk_rmbf, -5); + assert( status == E_OACV ); + + puts( "Init - ref_mbf - bad id (between 0 and -4) - E_ID" ); + status = ref_mbf(&pk_rmbf, -4); + assert( status == E_ID ); + + puts( "Init - ref_mbf - bad id (0) - E_ID" ); + status = ref_mbf(&pk_rmbf, 0); + assert( status == E_ID ); + + puts( "Init - ref_mbf - bad id (too great) - E_ID" ); + status = ref_mbf(&pk_rmbf, + CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS + 1); + assert( status == E_ID ); + + puts( "Init - ref_mbf - NULL pk_mbf returns E_PAR" ); + status = ref_mbf( NULL, 1 ); + assert( status == E_PAR ); + + puts( "Init - ref_mbf - mbf 1 - E_OK" ); + status = ref_mbf( &pk_rmbf, 1 ); + assert( status == E_OK ); + + printf( "Init - mbf 1 msgsz = %d\n", pk_rmbf.msgsz ); + printf( "Init - mbf 1 frbufsz = %d\n", pk_rmbf.frbufsz ); + printf( "Init - mbf 1 waiting tasks = %d\n", pk_rmbf.wtsk ); + printf( "Init - mbf 1 sending tasks = %d\n", pk_rmbf.stsk); +} + +void TestRcv() +{ + ER status; + char buffer[200]; + int s; + + puts( "Init - rcv_mbf - bad id (less than -4) - E_OACV" ); + status = rcv_mbf(buffer, &s, -5); + assert( status == E_OACV ); + + puts( "Init - rcv_mbf - bad id (between 0 and -4) - E_ID" ); + status = rcv_mbf(buffer, &s, -4); + assert( status == E_ID ); + + puts( "Init - rcv_mbf - bad id (0) - E_ID" ); + status = rcv_mbf(buffer, &s, 0); + assert( status == E_ID ); + + puts( "Init - rcv_mbf - bad id (too great) - E_ID" ); + status = rcv_mbf(buffer, &s, CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS + 1); + assert( status == E_ID ); + + puts( "Init - rcv_mbf - NULL msg returns E_PAR" ); + status = rcv_mbf(NULL, &s, 1); + assert( status == E_PAR ); + + puts( "Init - rcv_mbf - NULL p_msgsz returns E_PAR" ); + status = rcv_mbf(buffer, 0, 1); + assert( status == E_PAR ); + + puts("Init - rcv_mbf -- OK"); + status = rcv_mbf(buffer, &s, 1); + assert(status == E_OK); + printf("Message:[%s], length:%d\n", buffer, s); +} + + +void TestPrcv() +{ + ER status; + char buffer[200]; + int s; + + puts( "Init - prcv_mbf - bad id (less than -4) - E_OACV" ); + status = prcv_mbf(buffer, &s, -5); + assert( status == E_OACV ); + + puts( "Init - prcv_mbf - bad id (between 0 and -4) - E_ID" ); + status = prcv_mbf(buffer, &s, -4); + assert( status == E_ID ); + + puts( "Init - prcv_mbf - bad id (0) - E_ID" ); + status = prcv_mbf(buffer, &s, 0); + assert( status == E_ID ); + + puts( "Init - prcv_mbf - bad id (too great) - E_ID" ); + status = prcv_mbf(buffer, &s, CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS + 1); + assert( status == E_ID ); + + puts( "Init - prcv_mbf - NULL msg returns E_PAR" ); + status = prcv_mbf(NULL, &s, 1); + assert( status == E_PAR ); + + puts( "Init - prcv_mbf - NULL p_msgsz returns E_PAR" ); + status = prcv_mbf(buffer, 0, 1); + assert( status == E_PAR ); + + puts("Init - prcv_mbf -- E_TMOUT"); + status = prcv_mbf(buffer, &s, 1); + assert(status == E_TMOUT); +} + + +void TestTrcv() +{ + ER status; + char buffer[200]; + int s; + + puts( "Init - trcv_mbf - bad id (less than -4) - E_OACV" ); + status = trcv_mbf(buffer, &s, -5, 5000); + assert( status == E_OACV ); + + puts( "Init - trcv_mbf - bad id (between 0 and -4) - E_ID" ); + status = trcv_mbf(buffer, &s, -4, 5000); + assert( status == E_ID ); + + puts( "Init - trcv_mbf - bad id (0) - E_ID" ); + status = trcv_mbf(buffer, &s, 0, 5000); + assert( status == E_ID ); + + puts( "Init - trcv_mbf - bad id (too great) - E_ID" ); + status = trcv_mbf(buffer, &s, + CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS + 1, + 5000); + assert( status == E_ID ); + + puts( "Init - trcv_mbf - NULL msg returns E_PAR" ); + status = trcv_mbf(NULL, &s, 1, 5000); + assert( status == E_PAR ); + + puts( "Init - trcv_mbf - NULL p_msgsz returns E_PAR" ); + status = trcv_mbf(buffer, 0, 1, 5000); + assert( status == E_PAR ); + + puts( "Init - trcv_mbf - tmout <-2 returns E_PAR" ); + status = trcv_mbf(buffer, &s, 1, -2); + assert( status == E_PAR ); + + puts("\nInit - trcv_mbf -- E_TMOUT"); + put_time( "Init - starting to block at "); + status = trcv_mbf(buffer, &s, 1, 1000); + assert(status == E_TMOUT); + put_time( "Init - time out at "); +} + + diff --git a/testsuites/itrontests/itronmbf01/system.h b/testsuites/itrontests/itronmbf01/system.h new file mode 100644 index 0000000000..b433415b2b --- /dev/null +++ b/testsuites/itrontests/itronmbf01/system.h @@ -0,0 +1,37 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989-1998. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +/* functions */ + +void ITRON_Init( void ); + +/* configuration information */ + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_ITRON_INIT_TASK_TABLE +#define CONFIGURE_MAXIMUM_ITRON_MESSAGE_BUFFERS 10 + +#include + +/* global variables */ + +TEST_EXTERN rtems_id Global_variable; /* example global variable */ + +/* end of include file */ diff --git a/testsuites/itrontests/itronsem01/init.c b/testsuites/itrontests/itronsem01/init.c new file mode 100644 index 0000000000..4748de7f45 --- /dev/null +++ b/testsuites/itrontests/itronsem01/init.c @@ -0,0 +1,328 @@ +/* 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 + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#define TEST_INIT +#include "system.h" +#include + +/* + * The following is hopefully temporary. + */ + +#include + +#define put_time(_s) \ + do { \ + time_t a_time_t; \ + a_time_t = time( 0 ); \ + printf( "%s%s", _s, ctime( &a_time_t ) ); \ + } while(0) + +void ITRON_Init( void ) +{ + ER status; + T_CSEM pk_csem; + T_RSEM pk_rsem; + + printf( "\n\n*** ITRONSEM01 -- ITRON SEMAPHORE TEST ***\n" ); + + /* + * Exercise cre_sem - this code seems to exercise every path. + */ + + puts( "Init - cre_sem - NULL pk_sem returns E_PAR" ); + status = cre_sem( 1, NULL ); + assert( status == E_PAR ); + + puts( "Init - cre_sem - isemcnt > maxsem returns E_PAR" ); + pk_csem.isemcnt = 3; + pk_csem.maxsem = 2; + status = cre_sem( 1, &pk_csem ); + assert( status == E_PAR ); + + puts( "Init - cre_sem - maxsem of 0 returns E_PAR" ); + pk_csem.isemcnt = 0; + pk_csem.maxsem = 0; + status = cre_sem( 1, &pk_csem ); + assert( status == E_PAR ); + + /* + * Now run through all the bad ID errors + */ + + pk_csem.isemcnt = 2; + pk_csem.maxsem = 3; + puts( "Init - cre_sem - bad id (less than -4) - E_OACV" ); + status = cre_sem( -5, &pk_csem ); + assert( status == E_OACV ); + + puts( "Init - cre_sem - bad id (between 0 and -4) - E_ID" ); + status = cre_sem( -4, &pk_csem ); + assert( status == E_ID ); + + puts( "Init - cre_sem - bad id (0) - E_ID" ); + status = cre_sem( 0, &pk_csem ); + assert( status == E_ID ); + + puts( "Init - cre_sem - bad id (too great) - E_ID" ); + status = cre_sem( CONFIGURE_MAXIMUM_ITRON_SEMAPHORES + 1, &pk_csem ); + assert( status == E_ID ); + + puts( "Init - cre_sem - create semaphore 1 TA_TFIFO - E_OK" ); + pk_csem.isemcnt = 2; + pk_csem.maxsem = 3; + pk_csem.sematr = TA_TFIFO; + status = cre_sem( 1, &pk_csem ); + assert( status == E_OK ); + + puts( "Init - cre_sem - create semaphore 1 again - E_OBJ" ); + status = cre_sem( 1, &pk_csem ); + assert( status == E_OBJ ); + + puts( "Init - cre_sem - create semaphore 2 TA_TPRI - E_OK" ); + pk_csem.isemcnt = 2; + pk_csem.maxsem = 3; + pk_csem.sematr = TA_TPRI; + status = cre_sem( 2, &pk_csem ); + assert( status == E_OK ); + + /* + * Generate all the bad id errors for del_sem + */ + + puts( "Init - del_sem - bad id (less than -4) - E_OACV" ); + status = del_sem( -5 ); + assert( status == E_OACV ); + + puts( "Init - del_sem - bad id (between 0 and -4) - E_ID" ); + status = del_sem( -4 ); + assert( status == E_ID ); + + puts( "Init - del_sem - bad id (0) - E_ID" ); + status = del_sem( 0 ); + assert( status == E_ID ); + + puts( "Init - del_sem - bad id (too great) - E_ID" ); + status = del_sem( CONFIGURE_MAXIMUM_ITRON_SEMAPHORES + 1 ); + assert( status == E_ID ); + + /* + * Generate all the bad id errors for sig_sem + */ + + puts( "Init - sig_sem - bad id (less than -4) - E_OACV" ); + status = sig_sem( -5 ); + assert( status == E_OACV ); + + puts( "Init - sig_sem - bad id (between 0 and -4) - E_ID" ); + status = sig_sem( -4 ); + assert( status == E_ID ); + + puts( "Init - sig_sem - bad id (0) - E_ID" ); + status = sig_sem( 0 ); + assert( status == E_ID ); + + puts( "Init - sig_sem - bad id (too great) - E_ID" ); + status = wai_sem( CONFIGURE_MAXIMUM_ITRON_SEMAPHORES + 1 ); + assert( status == E_ID ); + + /* + * Generate all the bad id errors for preq_sem + */ + + puts( "Init - preq_sem - bad id (less than -4) - E_OACV" ); + status = preq_sem( -5 ); + assert( status == E_OACV ); + + puts( "Init - preq_sem - bad id (between 0 and -4) - E_ID" ); + status = preq_sem( -4 ); + assert( status == E_ID ); + + puts( "Init - preq_sem - bad id (0) - E_ID" ); + status = preq_sem( 0 ); + assert( status == E_ID ); + + puts( "Init - preq_sem - bad id (too great) - E_ID" ); + status = preq_sem( CONFIGURE_MAXIMUM_ITRON_SEMAPHORES + 1 ); + assert( status == E_ID ); + + /* + * Generate all the bad id errors for wai_sem + */ + + puts( "Init - wai_sem - bad id (less than -4) - E_OACV" ); + status = wai_sem( -5 ); + assert( status == E_OACV ); + + puts( "Init - wai_sem - bad id (between 0 and -4) - E_ID" ); + status = wai_sem( -4 ); + assert( status == E_ID ); + + puts( "Init - wai_sem - bad id (0) - E_ID" ); + status = wai_sem( 0 ); + assert( status == E_ID ); + + puts( "Init - wai_sem - bad id (too great) - E_ID" ); + status = wai_sem( CONFIGURE_MAXIMUM_ITRON_SEMAPHORES + 1 ); + assert( status == E_ID ); + + /* + * Generate all the bad id errors for twai_sem + */ + + puts( "Init - twai_sem - bad id (less than -4) - E_OACV" ); + status = twai_sem( -5, 1000 ); + assert( status == E_OACV ); + + puts( "Init - twai_sem - bad id (between 0 and -4) - E_ID" ); + status = twai_sem( -4, 1000 ); + assert( status == E_ID ); + + puts( "Init - twai_sem - bad id (0) - E_ID" ); + status = twai_sem( 0, 1000 ); + assert( status == E_ID ); + + puts( "Init - twai_sem - bad id (too great) - E_ID" ); + status = twai_sem( CONFIGURE_MAXIMUM_ITRON_SEMAPHORES + 1, 1000 ); + assert( status == E_ID ); + + /* + * Generate all the bad id errors for ref_sem + */ + + puts( "Init - ref_sem - bad id (less than -4) - E_OACV" ); + status = ref_sem( -5, &pk_rsem ); + assert( status == E_OACV ); + + puts( "Init - ref_sem - bad id (between 0 and -4) - E_ID" ); + status = ref_sem( -4, &pk_rsem ); + assert( status == E_ID ); + + puts( "Init - ref_sem - bad id (0) - E_ID" ); + status = ref_sem( 0, &pk_rsem ); + assert( status == E_ID ); + + puts( "Init - ref_sem - bad id (too great) - E_ID" ); + status = ref_sem( CONFIGURE_MAXIMUM_ITRON_SEMAPHORES + 1, &pk_rsem ); + assert( status == E_ID ); + + /* + * Exercise preq_sem (and sig_sem a little) + */ + + + puts( "Init - preq_sem - semaphore 1 available (count --> 1) - E_OK" ); + status = preq_sem( 1 ); + assert( status == E_OK ); + + puts( "Init - preq_sem - semaphore 1 available (count --> 0) - E_OK" ); + status = preq_sem( 1 ); + assert( status == E_OK ); + + puts( "Init - preq_sem - semaphore 1 unavailable - E_TMOUT" ); + status = preq_sem( 1 ); + assert( status == E_TMOUT ); + + puts( "Init - sig_sem - semaphore 1 (count --> 1) - E_OK" ); + status = sig_sem( 1 ); + assert( status == E_OK ); + + puts("Init - twai_sem(TMO_POL) - semaphore 1 available (count --> 0) - E_OK"); + status = twai_sem( 1, TMO_POL ); + assert( status == E_OK ); + + puts( "Init - twai_sem(TMO_POL) - semaphore 1 available - E_TMOUT" ); + status = twai_sem( 1, TMO_POL ); + assert( status == E_TMOUT ); + + /* + * Exercise twai_sem + */ + + puts( "Init - twai_sem - semaphore 1 unavailable - 1 second E_TMOUT" ); + put_time( "Init - starting to block at "); + status = twai_sem( 1, 1000 ); + assert( status == E_TMOUT ); + put_time( "Init - timed out at "); + puts( "Init - twai_sem - semaphore 1 unavailable - timeout completed" ); + + /* + * Now let's test exceed the maximum count of semaphore 1 + */ + + puts( "Init - sig_sem - semaphore 1 (count --> 1) - E_OK" ); + status = sig_sem( 1 ); + assert( status == E_OK ); + + puts( "Init - sig_sem - semaphore 1 (count --> 2) - E_OK" ); + status = sig_sem( 1 ); + assert( status == E_OK ); + + puts( "Init - sig_sem - semaphore 1 (count --> 3) - E_OK" ); + status = sig_sem( 1 ); + assert( status == E_OK ); + + puts( "Init - sig_sem - semaphore 1 (count > maximum) - E_QOVR" ); + status = sig_sem( 1 ); + assert( status == E_OK ); + + /* + * Exercise ref_sem + */ + + puts( "Init - ref_sem - NULL pk_sem returns E_PAR" ); + status = ref_sem( 1, NULL ); + assert( status == E_PAR ); + + puts( "Init - ref_sem - semaphore 1 - E_OK" ); + status = ref_sem( 1, &pk_rsem ); + assert( status == E_OK ); + printf( "Init - semaphore 1 count = %d\n", pk_rsem.semcnt ); + printf( "Init - semaphore 1 waiting tasks = %d\n", pk_rsem.wtsk ); + + puts( "Init - preq_sem - semaphore 1 (count --> 2) - E_OK" ); + status = preq_sem( 1 ); + assert( status == E_OK ); + + puts( "Init - ref_sem - semaphore 1 - E_OK" ); + status = ref_sem( 1, &pk_rsem ); + assert( status == E_OK ); + printf( "Init - semaphore 1 count = %d\n", pk_rsem.semcnt ); + printf( "Init - semaphore 1 waiting tasks = %d\n", pk_rsem.wtsk ); + + + /* + * Exercise del_sem + */ + + /* XXX really want another task blocking on the semaphore XXX */ + + puts( "Init - del_sem - semaphore 1 deleted - E_OK" ); + status = del_sem( 1 ); + assert( status == E_OK ); + + puts( "Init - XXX need other tasks to complete the test XXX" ); + + puts( "Init - dly_tsk - 1 second to let other task run" ); + status = dly_tsk( 1000 ); + assert( status == E_OK ); + + printf( "*** END OF ITRONSEM01 -- ITRON SEMAPHORE TEST ***\n" ); + exit( 0 ); +} diff --git a/testsuites/itrontests/itronsem01/system.h b/testsuites/itrontests/itronsem01/system.h new file mode 100644 index 0000000000..e3eac6012f --- /dev/null +++ b/testsuites/itrontests/itronsem01/system.h @@ -0,0 +1,39 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989-1998. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include +#include +#include + +/* functions */ + +void ITRON_Init( void ); + +/* configuration information */ + +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER + +#define CONFIGURE_ITRON_INIT_TASK_TABLE +#define CONFIGURE_MAXIMUM_ITRON_SEMAPHORES 10 + +#include + +/* global variables */ + +TEST_EXTERN rtems_id Global_variable; /* example global variable */ + +/* end of include file */ diff --git a/testsuites/itrontests/itrontask01/init.c b/testsuites/itrontests/itrontask01/init.c new file mode 100644 index 0000000000..3b36e2e9ec --- /dev/null +++ b/testsuites/itrontests/itrontask01/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. This test is based off of sp01. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989-1998. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + + +#define TEST_INIT +#include "system.h" + +#warning "Task_id is really an rtems_id" +void Task_1_through_3( void ){} + +void ITRON_Init( void ) +{ + rtems_time_of_day time; + ER status; + T_CTSK values; + + puts( "\n\n*** ITRONTASK01 - TICKER TEST ***" ); + + build_time( &time, 12, 31, 1988, 9, 0, 0, 0 ); + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + + values.exinf = NULL; + values.tskatr = TA_HLNG; + values.task = Task_1_through_3; + values.itskpri = 1; + values.stksz = RTEMS_MINIMUM_STACK_SIZE; + + status = cre_tsk( Task_id[1], &values ); + directive_failed( status, "cre_tsk of TA1" ); + + values.stksz = RTEMS_MINIMUM_STACK_SIZE; + status = cre_tsk( Task_id[2], &values ); + directive_failed( status, "cre_tsk of TA1" ); + + values.stksz = RTEMS_MINIMUM_STACK_SIZE; + status = cre_tsk( Task_id[3], &values ); + directive_failed( status, "cre_tsk of TA1" ); + +#if 0 + status = sta_tsk( Task_id[1] ); + directive_failed( status, "rtems_task_start of TA1" ); + + 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" ); +#endif +} diff --git a/testsuites/itrontests/itrontask01/system.h b/testsuites/itrontests/itrontask01/system.h new file mode 100644 index 0000000000..8a5b4ad378 --- /dev/null +++ b/testsuites/itrontests/itrontask01/system.h @@ -0,0 +1,39 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989-1998. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include +#include + +/* functions */ + +void ITRON_Init( void ); + +/* configuration information */ + +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_ITRON_INIT_TASK_TABLE + +#define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE) + +#include + +/* global variables */ + +TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */ + +/* end of include file */ diff --git a/testsuites/tmitrontests/Makefile.am b/testsuites/tmitrontests/Makefile.am new file mode 100644 index 0000000000..3b10073729 --- /dev/null +++ b/testsuites/tmitrontests/Makefile.am @@ -0,0 +1,21 @@ +## +## $Id$ +## + +AUTOMAKE_OPTIONS = foreign 1.4 +ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal + +project_bspdir = $(PROJECT_ROOT)/@RTEMS_BSP@ + +PREINSTALLDIRS = $(project_bspdir)/tests/screens/psxtests +$(PREINSTALLDIRS): + @$(mkinstalldirs) $@ + +all-local: $(PREINSTALLDIRS) + +ITRON_DIRS = include tmitronsem01 + +SUBDIRS = $(ITRON_DIRS) + +include $(top_srcdir)/../../../../automake/subdirs.am +include $(top_srcdir)/../../../../automake/local.am diff --git a/testsuites/tmitrontests/README b/testsuites/tmitrontests/README new file mode 100644 index 0000000000..65c5d4165d --- /dev/null +++ b/testsuites/tmitrontests/README @@ -0,0 +1,6 @@ +# +# $Id$ +# + +This directory contains the functionality tests for the ITRON 3.0 API +implementation. diff --git a/testsuites/tmitrontests/include/Makefile.am b/testsuites/tmitrontests/include/Makefile.am new file mode 100644 index 0000000000..fcf88cb578 --- /dev/null +++ b/testsuites/tmitrontests/include/Makefile.am @@ -0,0 +1,9 @@ +## +## $Id$ +## + +AUTOMAKE_OPTIONS = foreign 1.4 + +noinst_HEADERS = timesys.h + +include $(top_srcdir)/../../../../automake/local.am diff --git a/testsuites/tmitrontests/include/timesys.h b/testsuites/tmitrontests/include/timesys.h new file mode 100644 index 0000000000..4f75a9abf2 --- /dev/null +++ b/testsuites/tmitrontests/include/timesys.h @@ -0,0 +1,55 @@ +/* timesys.h + * + * This header file contains the global variables for the Time + * suite. + * + * COPYRIGHT (c) 1989-1998. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +/* + * 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 unsigned32 end_time; /* ending time variable */ +TEST_EXTERN volatile unsigned32 overhead; /* loop overhead variable */ + +/* end of include file */ diff --git a/testsuites/tmitrontests/tmitronsem01/init.c b/testsuites/tmitrontests/tmitronsem01/init.c new file mode 100644 index 0000000000..396d45d04b --- /dev/null +++ b/testsuites/tmitrontests/tmitronsem01/init.c @@ -0,0 +1,141 @@ +/* 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 + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#define TEST_INIT +#include "system.h" +#include +#include + +void ITRON_Init( void ) +{ + T_CSEM pk_csem; + T_RSEM pk_rsem; + int index; + + pk_csem.isemcnt = 2; + pk_csem.maxsem = 3; + pk_csem.sematr = TA_TFIFO; + + printf( "\n\n*** TMITRON01 -- ITRON TIMING TEST ***\n" ); + + /* + * time one invocation of cre_sem + */ + + Timer_initialize(); + (void) cre_sem( 1, &pk_csem ); + end_time = Read_timer(); + put_time( + "cre_sem", + end_time, + 1, + 0, /* no loop overhead to take out */ + 0 /* no calling overhead */ + ); + + /* + * time one invocation of del_sem + */ + + Timer_initialize(); + (void) del_sem( 1 ); + end_time = Read_timer(); + put_time( + "del_sem", + end_time, + 1, + 0, /* no loop overhead to take out */ + 0 /* no calling overhead */ + ); + + pk_csem.isemcnt = 100; + pk_csem.maxsem = 100; + pk_csem.sematr = TA_TFIFO; + (void) cre_sem( 1, &pk_csem ); + + /* + * time preq_sem (available) + */ + + Timer_initialize(); + for ( index = 1 ; index<=OPERATION_COUNT ; index++ ) + (void) preq_sem( 1 ); + end_time = Read_timer(); + put_time( + "preq_sem (available)", + end_time, + OPERATION_COUNT, + 0, /* don't take the loop overhead out */ + 0 /* no calling overhead */ + ); + + /* + * time preq_sem (not available) + */ + + Timer_initialize(); + for ( index = 1 ; index<=OPERATION_COUNT ; index++ ) + (void) preq_sem( 1 ); + end_time = Read_timer(); + put_time( + "preq_sem (not available)", + end_time, + OPERATION_COUNT, + 0, /* don't take the loop overhead out */ + 0 /* no calling overhead */ + ); + + /* + * time sig_sem (no waiting tasks) + */ + + Timer_initialize(); + for ( index = 1 ; index<=OPERATION_COUNT ; index++ ) + (void) sig_sem( 1 ); + end_time = Read_timer(); + put_time( + "sig_sem (no waiting tasks)", + end_time, + OPERATION_COUNT, + 0, /* don't take the loop overhead out */ + 0 /* no calling overhead */ + ); + + /* + * time ref_sem + */ + + Timer_initialize(); + for ( index = 1 ; index<=OPERATION_COUNT ; index++ ) + (void) ref_sem( 1, &pk_rsem ); + end_time = Read_timer(); + put_time( + "ref_sem", + end_time, + OPERATION_COUNT, + 0, /* don't take the loop overhead out */ + 0 /* no calling overhead */ + ); + + printf( "\n\nXXX ADD BLOCKING AND PREEMPTING TIME TESTS\n\n" ); + + + printf( "*** END OF TMITRON01 -- ITRON TIMING TEST ***\n" ); + exit( 0 ); +} diff --git a/testsuites/tmitrontests/tmitronsem01/system.h b/testsuites/tmitrontests/tmitronsem01/system.h new file mode 100644 index 0000000000..0537ae527a --- /dev/null +++ b/testsuites/tmitrontests/tmitronsem01/system.h @@ -0,0 +1,39 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989-1998. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include +#include +#include + +/* functions */ + +void ITRON_Init( void ); + +/* configuration information */ + +#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER + +#define CONFIGURE_ITRON_INIT_TASK_TABLE +#define CONFIGURE_MAXIMUM_ITRON_SEMAPHORES 100 + +#include + +/* global variables */ + +TEST_EXTERN rtems_id Global_variable; /* example global variable */ + +/* end of include file */ diff --git a/testsuites/tmitrontests/tmitronsem01/tmitronsem01.doc b/testsuites/tmitrontests/tmitronsem01/tmitronsem01.doc new file mode 100644 index 0000000000..558f0594c8 --- /dev/null +++ b/testsuites/tmitrontests/tmitronsem01/tmitronsem01.doc @@ -0,0 +1,9 @@ +# +# $Id$ +# +# The license and distribution terms for this file may be +# found in the file LICENSE in this distribution or at +# http://www.OARcorp.com/rtems/license.html. +# + +Time some basic ITRON semaphore operations -- cgit v1.2.3