From ac7d5ef06a6d6e8d84abbd1f0b82162725f98326 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 11 May 1995 17:39:37 +0000 Subject: Initial revision --- c/src/tests/sptests/README | 9 + c/src/tests/sptests/sp01/init.c | 89 +++++ c/src/tests/sptests/sp01/sp01.doc | 43 +++ c/src/tests/sptests/sp01/sp01.scn | 18 + c/src/tests/sptests/sp01/system.h | 30 ++ c/src/tests/sptests/sp01/task1.c | 50 +++ c/src/tests/sptests/sp02/init.c | 155 ++++++++ c/src/tests/sptests/sp02/preempt.c | 32 ++ c/src/tests/sptests/sp02/sp02.doc | 37 ++ c/src/tests/sptests/sp02/sp02.scn | 15 + c/src/tests/sptests/sp02/system.h | 31 ++ c/src/tests/sptests/sp02/task1.c | 66 ++++ c/src/tests/sptests/sp02/task2.c | 34 ++ c/src/tests/sptests/sp02/task3.c | 37 ++ c/src/tests/sptests/sp03/init.c | 70 ++++ c/src/tests/sptests/sp03/sp03.doc | 24 ++ c/src/tests/sptests/sp03/sp03.scn | 26 ++ c/src/tests/sptests/sp03/system.h | 30 ++ c/src/tests/sptests/sp03/task1.c | 59 ++++ c/src/tests/sptests/sp03/task2.c | 46 +++ c/src/tests/sptests/sp04/init.c | 113 ++++++ c/src/tests/sptests/sp04/sp04.doc | 38 ++ c/src/tests/sptests/sp04/sp04.scn | 24 ++ c/src/tests/sptests/sp04/system.h | 30 ++ c/src/tests/sptests/sp04/task1.c | 104 ++++++ c/src/tests/sptests/sp04/task2.c | 29 ++ c/src/tests/sptests/sp04/task3.c | 29 ++ c/src/tests/sptests/sp04/tswitch.c | 59 ++++ c/src/tests/sptests/sp05/init.c | 84 +++++ c/src/tests/sptests/sp05/sp05.doc | 26 ++ c/src/tests/sptests/sp05/sp05.scn | 47 +++ c/src/tests/sptests/sp05/system.h | 30 ++ c/src/tests/sptests/sp05/task1.c | 78 +++++ c/src/tests/sptests/sp05/task2.c | 39 +++ c/src/tests/sptests/sp05/task3.c | 39 +++ c/src/tests/sptests/sp06/init.c | 90 +++++ c/src/tests/sptests/sp06/sp06.doc | 26 ++ c/src/tests/sptests/sp06/sp06.scn | 40 +++ c/src/tests/sptests/sp06/system.h | 30 ++ c/src/tests/sptests/sp06/task1.c | 61 ++++ c/src/tests/sptests/sp06/task2.c | 40 +++ c/src/tests/sptests/sp06/task3.c | 32 ++ c/src/tests/sptests/sp07/init.c | 131 +++++++ c/src/tests/sptests/sp07/sp07.doc | 37 ++ c/src/tests/sptests/sp07/sp07.scn | 33 ++ c/src/tests/sptests/sp07/system.h | 35 ++ c/src/tests/sptests/sp07/task1.c | 85 +++++ c/src/tests/sptests/sp07/task2.c | 78 +++++ c/src/tests/sptests/sp07/task3.c | 34 ++ c/src/tests/sptests/sp07/task4.c | 30 ++ c/src/tests/sptests/sp07/taskexit.c | 33 ++ c/src/tests/sptests/sp07/tcreate.c | 34 ++ c/src/tests/sptests/sp07/tdelete.c | 37 ++ c/src/tests/sptests/sp07/trestart.c | 34 ++ c/src/tests/sptests/sp07/tstart.c | 34 ++ c/src/tests/sptests/sp08/init.c | 56 +++ c/src/tests/sptests/sp08/sp08.doc | 26 ++ c/src/tests/sptests/sp08/sp08.scn | 22 ++ c/src/tests/sptests/sp08/system.h | 33 ++ c/src/tests/sptests/sp08/task1.c | 256 ++++++++++++++ c/src/tests/sptests/sp09/delay.c | 28 ++ c/src/tests/sptests/sp09/init.c | 123 +++++++ c/src/tests/sptests/sp09/isr.c | 27 ++ c/src/tests/sptests/sp09/screen01.c | 168 +++++++++ c/src/tests/sptests/sp09/screen02.c | 192 ++++++++++ c/src/tests/sptests/sp09/screen03.c | 204 +++++++++++ c/src/tests/sptests/sp09/screen04.c | 85 +++++ c/src/tests/sptests/sp09/screen05.c | 148 ++++++++ c/src/tests/sptests/sp09/screen06.c | 125 +++++++ c/src/tests/sptests/sp09/screen07.c | 184 ++++++++++ c/src/tests/sptests/sp09/screen08.c | 121 +++++++ c/src/tests/sptests/sp09/screen09.c | 140 ++++++++ c/src/tests/sptests/sp09/screen10.c | 164 +++++++++ c/src/tests/sptests/sp09/screen11.c | 250 +++++++++++++ c/src/tests/sptests/sp09/screen12.c | 327 +++++++++++++++++ c/src/tests/sptests/sp09/screen13.c | 115 ++++++ c/src/tests/sptests/sp09/screen14.c | 162 +++++++++ c/src/tests/sptests/sp09/sp09.doc | 36 ++ c/src/tests/sptests/sp09/sp09.scn | 249 +++++++++++++ c/src/tests/sptests/sp09/system.h | 30 ++ c/src/tests/sptests/sp09/task1.c | 74 ++++ c/src/tests/sptests/sp09/task2.c | 48 +++ c/src/tests/sptests/sp09/task3.c | 51 +++ c/src/tests/sptests/sp09/task4.c | 50 +++ c/src/tests/sptests/sp11/init.c | 95 +++++ c/src/tests/sptests/sp11/sp11.doc | 26 ++ c/src/tests/sptests/sp11/sp11.scn | 74 ++++ c/src/tests/sptests/sp11/system.h | 30 ++ c/src/tests/sptests/sp11/task1.c | 410 ++++++++++++++++++++++ c/src/tests/sptests/sp11/task2.c | 126 +++++++ c/src/tests/sptests/sp11/timer.c | 97 ++++++ c/src/tests/sptests/sp12/init.c | 176 ++++++++++ c/src/tests/sptests/sp12/pridrv.c | 131 +++++++ c/src/tests/sptests/sp12/pritask.c | 91 +++++ c/src/tests/sptests/sp12/sp12.doc | 27 ++ c/src/tests/sptests/sp12/sp12.scn | 78 +++++ c/src/tests/sptests/sp12/system.h | 30 ++ c/src/tests/sptests/sp12/task1.c | 153 ++++++++ c/src/tests/sptests/sp12/task2.c | 65 ++++ c/src/tests/sptests/sp12/task3.c | 50 +++ c/src/tests/sptests/sp12/task4.c | 37 ++ c/src/tests/sptests/sp12/task5.c | 55 +++ c/src/tests/sptests/sp13/fillbuff.c | 31 ++ c/src/tests/sptests/sp13/init.c | 112 ++++++ c/src/tests/sptests/sp13/putbuff.c | 31 ++ c/src/tests/sptests/sp13/sp13.doc | 25 ++ c/src/tests/sptests/sp13/sp13.scn | 66 ++++ c/src/tests/sptests/sp13/system.h | 30 ++ c/src/tests/sptests/sp13/task1.c | 213 +++++++++++ c/src/tests/sptests/sp13/task2.c | 132 +++++++ c/src/tests/sptests/sp13/task3.c | 74 ++++ c/src/tests/sptests/sp14/asr.c | 47 +++ c/src/tests/sptests/sp14/init.c | 75 ++++ c/src/tests/sptests/sp14/sp14.doc | 24 ++ c/src/tests/sptests/sp14/sp14.scn | 33 ++ c/src/tests/sptests/sp14/system.h | 30 ++ c/src/tests/sptests/sp14/task1.c | 116 ++++++ c/src/tests/sptests/sp14/task2.c | 48 +++ c/src/tests/sptests/sp15/init.c | 81 +++++ c/src/tests/sptests/sp15/sp15.doc | 24 ++ c/src/tests/sptests/sp15/sp15.scn | 16 + c/src/tests/sptests/sp15/system.h | 30 ++ c/src/tests/sptests/sp15/task1.c | 129 +++++++ c/src/tests/sptests/sp16/init.c | 131 +++++++ c/src/tests/sptests/sp16/sp16.doc | 24 ++ c/src/tests/sptests/sp16/sp16.scn | 58 +++ c/src/tests/sptests/sp16/system.h | 32 ++ c/src/tests/sptests/sp16/task1.c | 282 +++++++++++++++ c/src/tests/sptests/sp16/task2.c | 86 +++++ c/src/tests/sptests/sp16/task3.c | 57 +++ c/src/tests/sptests/sp16/task4.c | 60 ++++ c/src/tests/sptests/sp16/task5.c | 73 ++++ c/src/tests/sptests/sp17/asr.c | 32 ++ c/src/tests/sptests/sp17/init.c | 72 ++++ c/src/tests/sptests/sp17/sp17.doc | 35 ++ c/src/tests/sptests/sp17/sp17.scn | 8 + c/src/tests/sptests/sp17/system.h | 30 ++ c/src/tests/sptests/sp17/task1.c | 48 +++ c/src/tests/sptests/sp17/task2.c | 45 +++ c/src/tests/sptests/sp19/first.c | 66 ++++ c/src/tests/sptests/sp19/fptask.c | 98 ++++++ c/src/tests/sptests/sp19/fptest.h | 165 +++++++++ c/src/tests/sptests/sp19/init.c | 153 ++++++++ c/src/tests/sptests/sp19/inttest.h | 149 ++++++++ c/src/tests/sptests/sp19/sp19.doc | 23 ++ c/src/tests/sptests/sp19/sp19.scn | 55 +++ c/src/tests/sptests/sp19/system.h | 30 ++ c/src/tests/sptests/sp19/task1.c | 59 ++++ c/src/tests/sptests/sp20/getall.c | 43 +++ c/src/tests/sptests/sp20/init.c | 71 ++++ c/src/tests/sptests/sp20/sp20.doc | 24 ++ c/src/tests/sptests/sp20/sp20.scn | 27 ++ c/src/tests/sptests/sp20/system.h | 34 ++ c/src/tests/sptests/sp20/task1.c | 116 ++++++ c/src/tests/sptests/sp21/init.c | 56 +++ c/src/tests/sptests/sp21/sp21.doc | 28 ++ c/src/tests/sptests/sp21/sp21.scn | 19 + c/src/tests/sptests/sp21/system.h | 30 ++ c/src/tests/sptests/sp21/task1.c | 106 ++++++ c/src/tests/sptests/sp22/delay.c | 32 ++ c/src/tests/sptests/sp22/init.c | 69 ++++ c/src/tests/sptests/sp22/prtime.c | 32 ++ c/src/tests/sptests/sp22/sp22.doc | 20 ++ c/src/tests/sptests/sp22/sp22.scn | 29 ++ c/src/tests/sptests/sp22/system.h | 30 ++ c/src/tests/sptests/sp22/task1.c | 164 +++++++++ c/src/tests/sptests/sp23/init.c | 72 ++++ c/src/tests/sptests/sp23/sp23.doc | 26 ++ c/src/tests/sptests/sp23/sp23.scn | 9 + c/src/tests/sptests/sp23/system.h | 30 ++ c/src/tests/sptests/sp23/task1.c | 96 +++++ c/src/tests/sptests/sp24/init.c | 79 +++++ c/src/tests/sptests/sp24/resume.c | 34 ++ c/src/tests/sptests/sp24/sp24.doc | 51 +++ c/src/tests/sptests/sp24/sp24.scn | 16 + c/src/tests/sptests/sp24/system.h | 30 ++ c/src/tests/sptests/sp24/task1.c | 58 +++ c/src/tests/sptests/sp25/init.c | 69 ++++ c/src/tests/sptests/sp25/sp25.doc | 32 ++ c/src/tests/sptests/sp25/sp25.scn | 29 ++ c/src/tests/sptests/sp25/system.h | 32 ++ c/src/tests/sptests/sp25/task1.c | 241 +++++++++++++ c/src/tests/sptests/spfatal/fatal.c | 134 +++++++ c/src/tests/sptests/spfatal/init.c | 54 +++ c/src/tests/sptests/spfatal/puterr.c | 68 ++++ c/src/tests/sptests/spfatal/spfatal.doc | 28 ++ c/src/tests/sptests/spfatal/spfatal.scn | 8 + c/src/tests/sptests/spfatal/system.h | 30 ++ c/src/tests/sptests/spfatal/task1.c | 29 ++ c/src/tests/sptests/spsize/getint.c | 32 ++ c/src/tests/sptests/spsize/init.c | 58 +++ c/src/tests/sptests/spsize/size.c | 601 ++++++++++++++++++++++++++++++++ 192 files changed, 13983 insertions(+) create mode 100644 c/src/tests/sptests/README create mode 100644 c/src/tests/sptests/sp01/init.c create mode 100644 c/src/tests/sptests/sp01/sp01.doc create mode 100644 c/src/tests/sptests/sp01/sp01.scn create mode 100644 c/src/tests/sptests/sp01/system.h create mode 100644 c/src/tests/sptests/sp01/task1.c create mode 100644 c/src/tests/sptests/sp02/init.c create mode 100644 c/src/tests/sptests/sp02/preempt.c create mode 100644 c/src/tests/sptests/sp02/sp02.doc create mode 100644 c/src/tests/sptests/sp02/sp02.scn create mode 100644 c/src/tests/sptests/sp02/system.h create mode 100644 c/src/tests/sptests/sp02/task1.c create mode 100644 c/src/tests/sptests/sp02/task2.c create mode 100644 c/src/tests/sptests/sp02/task3.c create mode 100644 c/src/tests/sptests/sp03/init.c create mode 100644 c/src/tests/sptests/sp03/sp03.doc create mode 100644 c/src/tests/sptests/sp03/sp03.scn create mode 100644 c/src/tests/sptests/sp03/system.h create mode 100644 c/src/tests/sptests/sp03/task1.c create mode 100644 c/src/tests/sptests/sp03/task2.c create mode 100644 c/src/tests/sptests/sp04/init.c create mode 100644 c/src/tests/sptests/sp04/sp04.doc create mode 100644 c/src/tests/sptests/sp04/sp04.scn create mode 100644 c/src/tests/sptests/sp04/system.h create mode 100644 c/src/tests/sptests/sp04/task1.c create mode 100644 c/src/tests/sptests/sp04/task2.c create mode 100644 c/src/tests/sptests/sp04/task3.c create mode 100644 c/src/tests/sptests/sp04/tswitch.c create mode 100644 c/src/tests/sptests/sp05/init.c create mode 100644 c/src/tests/sptests/sp05/sp05.doc create mode 100644 c/src/tests/sptests/sp05/sp05.scn create mode 100644 c/src/tests/sptests/sp05/system.h create mode 100644 c/src/tests/sptests/sp05/task1.c create mode 100644 c/src/tests/sptests/sp05/task2.c create mode 100644 c/src/tests/sptests/sp05/task3.c create mode 100644 c/src/tests/sptests/sp06/init.c create mode 100644 c/src/tests/sptests/sp06/sp06.doc create mode 100644 c/src/tests/sptests/sp06/sp06.scn create mode 100644 c/src/tests/sptests/sp06/system.h create mode 100644 c/src/tests/sptests/sp06/task1.c create mode 100644 c/src/tests/sptests/sp06/task2.c create mode 100644 c/src/tests/sptests/sp06/task3.c create mode 100644 c/src/tests/sptests/sp07/init.c create mode 100644 c/src/tests/sptests/sp07/sp07.doc create mode 100644 c/src/tests/sptests/sp07/sp07.scn create mode 100644 c/src/tests/sptests/sp07/system.h create mode 100644 c/src/tests/sptests/sp07/task1.c create mode 100644 c/src/tests/sptests/sp07/task2.c create mode 100644 c/src/tests/sptests/sp07/task3.c create mode 100644 c/src/tests/sptests/sp07/task4.c create mode 100644 c/src/tests/sptests/sp07/taskexit.c create mode 100644 c/src/tests/sptests/sp07/tcreate.c create mode 100644 c/src/tests/sptests/sp07/tdelete.c create mode 100644 c/src/tests/sptests/sp07/trestart.c create mode 100644 c/src/tests/sptests/sp07/tstart.c create mode 100644 c/src/tests/sptests/sp08/init.c create mode 100644 c/src/tests/sptests/sp08/sp08.doc create mode 100644 c/src/tests/sptests/sp08/sp08.scn create mode 100644 c/src/tests/sptests/sp08/system.h create mode 100644 c/src/tests/sptests/sp08/task1.c create mode 100644 c/src/tests/sptests/sp09/delay.c create mode 100644 c/src/tests/sptests/sp09/init.c create mode 100644 c/src/tests/sptests/sp09/isr.c create mode 100644 c/src/tests/sptests/sp09/screen01.c create mode 100644 c/src/tests/sptests/sp09/screen02.c create mode 100644 c/src/tests/sptests/sp09/screen03.c create mode 100644 c/src/tests/sptests/sp09/screen04.c create mode 100644 c/src/tests/sptests/sp09/screen05.c create mode 100644 c/src/tests/sptests/sp09/screen06.c create mode 100644 c/src/tests/sptests/sp09/screen07.c create mode 100644 c/src/tests/sptests/sp09/screen08.c create mode 100644 c/src/tests/sptests/sp09/screen09.c create mode 100644 c/src/tests/sptests/sp09/screen10.c create mode 100644 c/src/tests/sptests/sp09/screen11.c create mode 100644 c/src/tests/sptests/sp09/screen12.c create mode 100644 c/src/tests/sptests/sp09/screen13.c create mode 100644 c/src/tests/sptests/sp09/screen14.c create mode 100644 c/src/tests/sptests/sp09/sp09.doc create mode 100644 c/src/tests/sptests/sp09/sp09.scn create mode 100644 c/src/tests/sptests/sp09/system.h create mode 100644 c/src/tests/sptests/sp09/task1.c create mode 100644 c/src/tests/sptests/sp09/task2.c create mode 100644 c/src/tests/sptests/sp09/task3.c create mode 100644 c/src/tests/sptests/sp09/task4.c create mode 100644 c/src/tests/sptests/sp11/init.c create mode 100644 c/src/tests/sptests/sp11/sp11.doc create mode 100644 c/src/tests/sptests/sp11/sp11.scn create mode 100644 c/src/tests/sptests/sp11/system.h create mode 100644 c/src/tests/sptests/sp11/task1.c create mode 100644 c/src/tests/sptests/sp11/task2.c create mode 100644 c/src/tests/sptests/sp11/timer.c create mode 100644 c/src/tests/sptests/sp12/init.c create mode 100644 c/src/tests/sptests/sp12/pridrv.c create mode 100644 c/src/tests/sptests/sp12/pritask.c create mode 100644 c/src/tests/sptests/sp12/sp12.doc create mode 100644 c/src/tests/sptests/sp12/sp12.scn create mode 100644 c/src/tests/sptests/sp12/system.h create mode 100644 c/src/tests/sptests/sp12/task1.c create mode 100644 c/src/tests/sptests/sp12/task2.c create mode 100644 c/src/tests/sptests/sp12/task3.c create mode 100644 c/src/tests/sptests/sp12/task4.c create mode 100644 c/src/tests/sptests/sp12/task5.c create mode 100644 c/src/tests/sptests/sp13/fillbuff.c create mode 100644 c/src/tests/sptests/sp13/init.c create mode 100644 c/src/tests/sptests/sp13/putbuff.c create mode 100644 c/src/tests/sptests/sp13/sp13.doc create mode 100644 c/src/tests/sptests/sp13/sp13.scn create mode 100644 c/src/tests/sptests/sp13/system.h create mode 100644 c/src/tests/sptests/sp13/task1.c create mode 100644 c/src/tests/sptests/sp13/task2.c create mode 100644 c/src/tests/sptests/sp13/task3.c create mode 100644 c/src/tests/sptests/sp14/asr.c create mode 100644 c/src/tests/sptests/sp14/init.c create mode 100644 c/src/tests/sptests/sp14/sp14.doc create mode 100644 c/src/tests/sptests/sp14/sp14.scn create mode 100644 c/src/tests/sptests/sp14/system.h create mode 100644 c/src/tests/sptests/sp14/task1.c create mode 100644 c/src/tests/sptests/sp14/task2.c create mode 100644 c/src/tests/sptests/sp15/init.c create mode 100644 c/src/tests/sptests/sp15/sp15.doc create mode 100644 c/src/tests/sptests/sp15/sp15.scn create mode 100644 c/src/tests/sptests/sp15/system.h create mode 100644 c/src/tests/sptests/sp15/task1.c create mode 100644 c/src/tests/sptests/sp16/init.c create mode 100644 c/src/tests/sptests/sp16/sp16.doc create mode 100644 c/src/tests/sptests/sp16/sp16.scn create mode 100644 c/src/tests/sptests/sp16/system.h create mode 100644 c/src/tests/sptests/sp16/task1.c create mode 100644 c/src/tests/sptests/sp16/task2.c create mode 100644 c/src/tests/sptests/sp16/task3.c create mode 100644 c/src/tests/sptests/sp16/task4.c create mode 100644 c/src/tests/sptests/sp16/task5.c create mode 100644 c/src/tests/sptests/sp17/asr.c create mode 100644 c/src/tests/sptests/sp17/init.c create mode 100644 c/src/tests/sptests/sp17/sp17.doc create mode 100644 c/src/tests/sptests/sp17/sp17.scn create mode 100644 c/src/tests/sptests/sp17/system.h create mode 100644 c/src/tests/sptests/sp17/task1.c create mode 100644 c/src/tests/sptests/sp17/task2.c create mode 100644 c/src/tests/sptests/sp19/first.c create mode 100644 c/src/tests/sptests/sp19/fptask.c create mode 100644 c/src/tests/sptests/sp19/fptest.h create mode 100644 c/src/tests/sptests/sp19/init.c create mode 100644 c/src/tests/sptests/sp19/inttest.h create mode 100644 c/src/tests/sptests/sp19/sp19.doc create mode 100644 c/src/tests/sptests/sp19/sp19.scn create mode 100644 c/src/tests/sptests/sp19/system.h create mode 100644 c/src/tests/sptests/sp19/task1.c create mode 100644 c/src/tests/sptests/sp20/getall.c create mode 100644 c/src/tests/sptests/sp20/init.c create mode 100644 c/src/tests/sptests/sp20/sp20.doc create mode 100644 c/src/tests/sptests/sp20/sp20.scn create mode 100644 c/src/tests/sptests/sp20/system.h create mode 100644 c/src/tests/sptests/sp20/task1.c create mode 100644 c/src/tests/sptests/sp21/init.c create mode 100644 c/src/tests/sptests/sp21/sp21.doc create mode 100644 c/src/tests/sptests/sp21/sp21.scn create mode 100644 c/src/tests/sptests/sp21/system.h create mode 100644 c/src/tests/sptests/sp21/task1.c create mode 100644 c/src/tests/sptests/sp22/delay.c create mode 100644 c/src/tests/sptests/sp22/init.c create mode 100644 c/src/tests/sptests/sp22/prtime.c create mode 100644 c/src/tests/sptests/sp22/sp22.doc create mode 100644 c/src/tests/sptests/sp22/sp22.scn create mode 100644 c/src/tests/sptests/sp22/system.h create mode 100644 c/src/tests/sptests/sp22/task1.c create mode 100644 c/src/tests/sptests/sp23/init.c create mode 100644 c/src/tests/sptests/sp23/sp23.doc create mode 100644 c/src/tests/sptests/sp23/sp23.scn create mode 100644 c/src/tests/sptests/sp23/system.h create mode 100644 c/src/tests/sptests/sp23/task1.c create mode 100644 c/src/tests/sptests/sp24/init.c create mode 100644 c/src/tests/sptests/sp24/resume.c create mode 100644 c/src/tests/sptests/sp24/sp24.doc create mode 100644 c/src/tests/sptests/sp24/sp24.scn create mode 100644 c/src/tests/sptests/sp24/system.h create mode 100644 c/src/tests/sptests/sp24/task1.c create mode 100644 c/src/tests/sptests/sp25/init.c create mode 100644 c/src/tests/sptests/sp25/sp25.doc create mode 100644 c/src/tests/sptests/sp25/sp25.scn create mode 100644 c/src/tests/sptests/sp25/system.h create mode 100644 c/src/tests/sptests/sp25/task1.c create mode 100644 c/src/tests/sptests/spfatal/fatal.c create mode 100644 c/src/tests/sptests/spfatal/init.c create mode 100644 c/src/tests/sptests/spfatal/puterr.c create mode 100644 c/src/tests/sptests/spfatal/spfatal.doc create mode 100644 c/src/tests/sptests/spfatal/spfatal.scn create mode 100644 c/src/tests/sptests/spfatal/system.h create mode 100644 c/src/tests/sptests/spfatal/task1.c create mode 100644 c/src/tests/sptests/spsize/getint.c create mode 100644 c/src/tests/sptests/spsize/init.c create mode 100644 c/src/tests/sptests/spsize/size.c (limited to 'c/src/tests/sptests') diff --git a/c/src/tests/sptests/README b/c/src/tests/sptests/README new file mode 100644 index 0000000000..2843063c31 --- /dev/null +++ b/c/src/tests/sptests/README @@ -0,0 +1,9 @@ +# +# $Id$ +# + +This directory contains the RTEMS Single Processor Test Suite. +The tests in this directory provide near complete (98%+) test +coverage of the non-multiprocessor code in RTEMS. + + diff --git a/c/src/tests/sptests/sp01/init.c b/c/src/tests/sptests/sp01/init.c new file mode 100644 index 0000000000..82ffd0015c --- /dev/null +++ b/c/src/tests/sptests/sp01/init.c @@ -0,0 +1,89 @@ +/* Init + * + * This routine is the initialization task for this test program. + * It is a user initialization task and has the responsibility for creating + * and starting the tasks that make up the test. If the time of day + * clock is required for the test, it should also be set to a known + * value by this function. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_time_of_day time; + rtems_status_code status; + + puts( "\n\n*** TEST 1 ***" ); + + build_time( &time, 12, 31, 1988, 9, 0, 0, 0 ); + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + 1, + 2 * 1024, + RTEMS_INTERRUPT_LEVEL(31), + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_create( + Task_name[ 2 ], + 1, + 2 * 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create of TA2" ); + + status = rtems_task_create( + Task_name[ 3 ], + 1, + 2 * 1024, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 3 ] + ); + directive_failed( status, "rtems_task_create of TA3" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1_through_3, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_start( Task_id[ 2 ], Task_1_through_3, 0 ); + directive_failed( status, "rtems_task_start of TA2" ); + + status = rtems_task_start( Task_id[ 3 ], Task_1_through_3, 0 ); + directive_failed( status, "rtems_task_start of TA3" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/c/src/tests/sptests/sp01/sp01.doc b/c/src/tests/sptests/sp01/sp01.doc new file mode 100644 index 0000000000..79b1aaaa87 --- /dev/null +++ b/c/src/tests/sptests/sp01/sp01.doc @@ -0,0 +1,43 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + +This file describes the directives and concepts tested by this test set. + +test set name: test1 + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident, + tm_set, tm_get, tm_wkafter + +concepts: + + a. Verifies system can create and start both the executive's system + initialization and idle task. + + b. Verifies executive can swap between three application tasks at the + same priority and the executive's internal idle task. + + c. Verifies can print strings to the CRT on port 2 of the mvme136 board + using Print and Println in the board support package. + + d. Verifies interrupt handler can handle a task switch from an interrupt + as specified with the i_return directive. + + e. Verifies executive initialization performed correctly. + + f. Verifies the executive trap handler except for the halt function. + + g. Verifies that a task can get the task identification number of itself. + +output: + "TA1" is printed once every 5 seconds. "TA2" is printed once + every 10 seconds. "TA3" is printed once every 15 seconds. diff --git a/c/src/tests/sptests/sp01/sp01.scn b/c/src/tests/sptests/sp01/sp01.scn new file mode 100644 index 0000000000..d4fcc4561b --- /dev/null +++ b/c/src/tests/sptests/sp01/sp01.scn @@ -0,0 +1,18 @@ +*** TEST 1 *** +TA1 - rtems_clock_get - 09:00:00 12/31/1988 +TA2 - rtems_clock_get - 09:00:00 12/31/1988 +TA3 - rtems_clock_get - 09:00:00 12/31/1988 +TA1 - rtems_clock_get - 09:00:05 12/31/1988 +TA2 - rtems_clock_get - 09:00:10 12/31/1988 +TA1 - rtems_clock_get - 09:00:10 12/31/1988 +TA3 - rtems_clock_get - 09:00:15 12/31/1988 +TA1 - rtems_clock_get - 09:00:15 12/31/1988 +TA2 - rtems_clock_get - 09:00:20 12/31/1988 +TA1 - rtems_clock_get - 09:00:20 12/31/1988 +TA1 - rtems_clock_get - 09:00:25 12/31/1988 +TA3 - rtems_clock_get - 09:00:30 12/31/1988 +TA1 - rtems_clock_get - 09:00:30 12/31/1988 +TA2 - rtems_clock_get - 09:00:30 12/31/1988 +*** END OF TEST 1 *** + +NOTE: The order of the prints at each time interval is irrelevant. diff --git a/c/src/tests/sptests/sp01/system.h b/c/src/tests/sptests/sp01/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/c/src/tests/sptests/sp01/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/c/src/tests/sptests/sp01/task1.c b/c/src/tests/sptests/sp01/task1.c new file mode 100644 index 0000000000..b45d3abce6 --- /dev/null +++ b/c/src/tests/sptests/sp01/task1.c @@ -0,0 +1,50 @@ +/* Task_1_through_3 + * + * This routine serves as a test task. It verifies the basic task + * switching capabilities of the executive. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_1_through_3( + rtems_task_argument argument +) +{ + rtems_id tid; + rtems_time_of_day time; + rtems_status_code status; + + status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid ); + directive_failed( status, "rtems_task_ident" ); + + while( FOREVER ) { + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_get" ); + + if ( time.second >= 35 ) { + puts( "*** END OF TEST 1 ***" ); + exit( 0 ); + } + + put_name( Task_name[ task_number( tid ) ], FALSE ); + print_time( " - rtems_clock_get - ", &time, "\n" ); + + status = rtems_task_wake_after( task_number( tid ) * 5 * TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + } +} diff --git a/c/src/tests/sptests/sp02/init.c b/c/src/tests/sptests/sp02/init.c new file mode 100644 index 0000000000..b3ada92914 --- /dev/null +++ b/c/src/tests/sptests/sp02/init.c @@ -0,0 +1,155 @@ +/* Init + * + * This routine is the initialization task for this test program. + * It is a user initialization task and has the responsibility for creating + * and starting the tasks that make up the test. If the time of day + * clock is required for the test, it should also be set to a known + * value by this function. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TEST 2 ***" ); + + Preempt_task_name = rtems_build_name( 'P', 'R', 'M', 'T' ); + + status = rtems_task_create( + Preempt_task_name, + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Preempt_task_id + ); + directive_failed( status, "rtems_task_create of RTEMS_PREEMPT" ); + + status = rtems_task_start( Preempt_task_id, Preempt_task, 0 ); + directive_failed( status, "rtems_task_start of RTEMS_PREEMPT" ); + + puts( "INIT - rtems_task_wake_after - yielding processor" ); + status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + directive_failed( status, "rtems_task_wake_after" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + 3, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_create( + Task_name[ 2 ], + 3, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create of TA2" ); + + status = rtems_task_create( + Task_name[ 3 ], + 3, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 3 ] + ); + directive_failed( status, "rtems_task_create of TA3" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_start( Task_id[ 2 ], Task_2, 0 ); + directive_failed( status, "rtems_task_start of TA2" ); + + status = rtems_task_start( Task_id[ 3 ], Task_3, 0 ); + directive_failed( status, "rtems_task_start of TA3" ); + + puts( "INIT - suspending TA2 while middle task on a ready chain" ); + status = rtems_task_suspend( Task_id[ 2 ] ); + directive_failed( status, "rtems_task_suspend of TA2" ); + + status = rtems_task_delete( Task_id[ 1 ] ); + directive_failed( status, "rtems_task_delete of TA1" ); + + status = rtems_task_delete( Task_id[ 2 ] ); + directive_failed( status, "rtems_task_delete of TA2" ); + + status = rtems_task_delete( Task_id[ 3 ] ); + directive_failed( status, "rtems_task_delete of TA3" ); + + status = rtems_task_create( + Task_name[ 1 ], + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_create( + Task_name[ 2 ], + 3, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create of TA2" ); + + status = rtems_task_create( + Task_name[ 3 ], + 3, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 3 ] + ); + directive_failed( status, "rtems_task_create of TA3" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_start( Task_id[ 2 ], Task_2, 0 ); + directive_failed( status, "rtems_task_start of TA2" ); + + status = rtems_task_start( Task_id[ 3 ], Task_3, 0 ); + directive_failed( status, "rtems_task_start of TA3" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/c/src/tests/sptests/sp02/preempt.c b/c/src/tests/sptests/sp02/preempt.c new file mode 100644 index 0000000000..7e93f7af57 --- /dev/null +++ b/c/src/tests/sptests/sp02/preempt.c @@ -0,0 +1,32 @@ +/* Preempt_task + * + * This routine serves as a test task. It verifies the task manager. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Preempt_task( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "PREEMPT - rtems_task_delete - deleting self" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_PREEMPT" ); +} diff --git a/c/src/tests/sptests/sp02/sp02.doc b/c/src/tests/sptests/sp02/sp02.doc new file mode 100644 index 0000000000..00f2e0e7b3 --- /dev/null +++ b/c/src/tests/sptests/sp02/sp02.doc @@ -0,0 +1,37 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test2 + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident, + t_delete, tm_wkafter, t_setpri, t_suspend + +concepts: + + a. Verifies that a task can delete another task and also delete itself. + + b. Verifies that memory is freed back to the heap correctly. + + c. Verifies that TCBs are freed back to the inactive chain correctly. + + d. Verifies that a task can get the task identification number of + another task. + + e. Verifies the _Set_state routine where the task is not READY. + + f. Verifies the break statement in the _Block_activate routine. + + g. Verifies the while loop in the _Prev_tcb routine. diff --git a/c/src/tests/sptests/sp02/sp02.scn b/c/src/tests/sptests/sp02/sp02.scn new file mode 100644 index 0000000000..57a4627284 --- /dev/null +++ b/c/src/tests/sptests/sp02/sp02.scn @@ -0,0 +1,15 @@ +*** TEST 2 *** +INIT - rtems_task_wake_after - yielding processor +PREEMPT - rtems_task_delete - deleting self +INIT - suspending TA2 while middle task on a ready chain +TA1 - rtems_task_wake_after - sleep 1 second +TA2 - rtems_task_wake_after - sleep 1 minute +TA3 - rtems_task_wake_after - sleep 5 seconds +TA1 - rtems_task_ident - tid of TA2 (0x00010007) +TA1 - rtems_task_ident - tid of TA3 (0x00010008) +TA1 - rtems_task_set_priority - set TA3's priority to 2 +TA1 - rtems_task_suspend - suspend TA2 +TA1 - rtems_task_delete - delete TA2 +TA1 - rtems_task_wake_after - sleep for 5 seconds +TA3 - rtems_task_delete - delete self +*** END OF TEST 2 *** diff --git a/c/src/tests/sptests/sp02/system.h b/c/src/tests/sptests/sp02/system.h new file mode 100644 index 0000000000..c9d89a1e8b --- /dev/null +++ b/c/src/tests/sptests/sp02/system.h @@ -0,0 +1,31 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/c/src/tests/sptests/sp02/task1.c b/c/src/tests/sptests/sp02/task1.c new file mode 100644 index 0000000000..0f6152dbb2 --- /dev/null +++ b/c/src/tests/sptests/sp02/task1.c @@ -0,0 +1,66 @@ +/* Task_1 + * + * This routine serves as a test task. It verifies the task manager. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_id tid2; + rtems_id tid3; + rtems_status_code status; + rtems_unsigned32 previous_priority; + + puts( "TA1 - rtems_task_wake_after - sleep 1 second" ); + status = rtems_task_wake_after( 1*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + status = rtems_task_ident( Task_name[ 2 ], RTEMS_SEARCH_ALL_NODES, &tid2 ); + directive_failed( status, "rtems_task_ident of TA2" ); + + printf( "TA1 - rtems_task_ident - tid of TA2 (0x%.8x)\n", tid2 ); + + status = rtems_task_ident( Task_name[ 3 ], RTEMS_SEARCH_ALL_NODES, &tid3 ); + directive_failed( status, "rtems_task_ident of TA3" ); + + printf( "TA1 - rtems_task_ident - tid of TA3 (0x%.8x)\n", tid3 ); + + status = rtems_task_set_priority( tid3, 2, &previous_priority ); + directive_failed( status, "rtems_task_set_priority" ); + + puts( "TA1 - rtems_task_set_priority - set TA3's priority to 2" ); + + + puts( "TA1 - rtems_task_suspend - suspend TA2" ); + status = rtems_task_suspend( tid2 ); + directive_failed( status, "rtems_task_suspend of TA2" ); + + puts( "TA1 - rtems_task_delete - delete TA2" ); + status = rtems_task_delete( tid2 ); + directive_failed( status, "rtems_task_delete of TA2" ); + + puts( "TA1 - rtems_task_wake_after - sleep for 5 seconds" ); + status = rtems_task_wake_after( 5*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "*** END OF TEST 2 ***" ); + exit( 0 ); +} diff --git a/c/src/tests/sptests/sp02/task2.c b/c/src/tests/sptests/sp02/task2.c new file mode 100644 index 0000000000..f39cc5b9fc --- /dev/null +++ b/c/src/tests/sptests/sp02/task2.c @@ -0,0 +1,34 @@ +/* Task_2 + * + * This routine serves as a test task. It sleeps for 1 minute but + * does not expect to wake up. Task 1 should suspend then delete it + * so that it appears to never wake up. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_2( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "TA2 - rtems_task_wake_after - sleep 1 minute" ); + status = rtems_task_wake_after( 60*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after in TA2" ); +} diff --git a/c/src/tests/sptests/sp02/task3.c b/c/src/tests/sptests/sp02/task3.c new file mode 100644 index 0000000000..89bda38b7c --- /dev/null +++ b/c/src/tests/sptests/sp02/task3.c @@ -0,0 +1,37 @@ +/* Task_3 + * + * This routine serves as a test task. It simply sleeps for 5 seconds + * and then deletes itself. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_3( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "TA3 - rtems_task_wake_after - sleep 5 seconds" ); + status = rtems_task_wake_after( 5*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after in TA3" ); + + puts( "TA3 - rtems_task_delete - delete self" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of TA3" ); +} diff --git a/c/src/tests/sptests/sp03/init.c b/c/src/tests/sptests/sp03/init.c new file mode 100644 index 0000000000..962d434284 --- /dev/null +++ b/c/src/tests/sptests/sp03/init.c @@ -0,0 +1,70 @@ +/* Init + * + * This routine is the initialization task for this test program. + * It is a user initialization task and has the responsibility for creating + * and starting the tasks that make up the test. If the time of day + * clock is required for the test, it should also be set to a known + * value by this function. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TEST 3 ***" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_create( + Task_name[ 2 ], + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create of TA2" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_start( Task_id[ 2 ], Task_2, 0 ); + directive_failed( status, "rtems_task_start of TA2" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/c/src/tests/sptests/sp03/sp03.doc b/c/src/tests/sptests/sp03/sp03.doc new file mode 100644 index 0000000000..96d6d41d94 --- /dev/null +++ b/c/src/tests/sptests/sp03/sp03.doc @@ -0,0 +1,24 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test3 + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, tm_wkafter, + tm_wkwhen, tm_set, tm_get + +concepts: + + a. Verifies conversion routines - _Utd_to_etd and _Etd_to_utd diff --git a/c/src/tests/sptests/sp03/sp03.scn b/c/src/tests/sptests/sp03/sp03.scn new file mode 100644 index 0000000000..496982e86f --- /dev/null +++ b/c/src/tests/sptests/sp03/sp03.scn @@ -0,0 +1,26 @@ +*** TEST 3 *** +TA1 sets clock: 09:15:00 12/31/1988 +TA1 going to sleep: 09:15:00 12/31/1988 +TA2 09:15:01 12/31/1988 +TA2 09:15:02 12/31/1988 +TA2 09:15:03 12/31/1988 +TA2 09:15:04 12/31/1988 +TA1 awakened: 09:15:05 12/31/1988 +TA1 going to sleep: 09:15:05 12/31/1988 +TA2 09:15:05 12/31/1988 +TA2 09:15:06 12/31/1988 +TA2 09:15:07 12/31/1988 +TA2 09:15:08 12/31/1988 +TA2 09:15:09 12/31/1988 +TA1 awakened: 09:15:10 12/31/1988 +TA1 going to sleep: 09:15:10 12/31/1988 +TA2 09:15:10 12/31/1988 +TA2 09:15:11 12/31/1988 +TA2 09:15:12 12/31/1988 +TA2 09:15:13 12/31/1988 +TA2 09:15:14 12/31/1988 +TA1 awakened: 09:15:15 12/31/1988 +TA1 going to sleep: 09:15:15 12/31/1988 +TA2 09:15:15 12/31/1988 +TA2 09:15:16 12/31/1988 +*** END OF TEST 3 *** diff --git a/c/src/tests/sptests/sp03/system.h b/c/src/tests/sptests/sp03/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/c/src/tests/sptests/sp03/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/c/src/tests/sptests/sp03/task1.c b/c/src/tests/sptests/sp03/task1.c new file mode 100644 index 0000000000..e59fad45cf --- /dev/null +++ b/c/src/tests/sptests/sp03/task1.c @@ -0,0 +1,59 @@ +/* Task_1 + * + * This routine serves as a test task. It verifies the capability to + * set and read the executives calender and clock. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_time_of_day time; + + build_time( &time, 12, 31, 1988, 9, 15, 0, 0 ); + + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + + put_name( Task_name[ 1 ], FALSE ); + print_time( " sets clock: ", &time, "\n" ); + + while( FOREVER ) { + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_get" ); + + put_name( Task_name[ 1 ], FALSE ); + print_time( " going to sleep: ", &time, "\n" ); + + time.second += 5; + time.minute += ( time.second / 60 ); + time.second %= 60; + time.hour += ( time.minute / 60 ); + time.minute %= 60; + time.hour %= 24; + + status = rtems_task_wake_when( &time ); + directive_failed( status, "rtems_task_wake_when" ); + + put_name( Task_name[ 1 ], FALSE ); + print_time( " awakened: ", &time, "\n" ); + } +} diff --git a/c/src/tests/sptests/sp03/task2.c b/c/src/tests/sptests/sp03/task2.c new file mode 100644 index 0000000000..8838c1db67 --- /dev/null +++ b/c/src/tests/sptests/sp03/task2.c @@ -0,0 +1,46 @@ +/* Task_2 + * + * This routine serves as a test task. It repeatedly gets the system time + * and date, converts it to printable form, and print it. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_2( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_time_of_day time; + + while( FOREVER ) { + status = rtems_task_wake_after( 1*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_get" ); + + if ( time.second >= 17 ) { + puts( "*** END OF TEST 3 *** " ); + exit( 0 ); + } + + put_name( Task_name[ 2 ], FALSE ); + print_time( " ", &time, "\n" ); + } +} diff --git a/c/src/tests/sptests/sp04/init.c b/c/src/tests/sptests/sp04/init.c new file mode 100644 index 0000000000..b9fd541103 --- /dev/null +++ b/c/src/tests/sptests/sp04/init.c @@ -0,0 +1,113 @@ +/* Init + * + * This routine is the initialization task for this test program. + * It is a user initialization task and has the responsibility for creating + * and starting the tasks that make up the test. If the time of day + * clock is required for the test, it should also be set to a known + * value by this function. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_extensions_table Extensions = { + NULL, /* task create user extension */ + NULL, /* task start user extension */ + NULL, /* task restart user extension */ + NULL, /* task delete user extension */ + Task_switch, /* task switch user extension */ + NULL, /* task begin user extension */ + NULL, /* task exitted user extension */ + NULL /* fatal error user extension */ +}; + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_time_of_day time; + + puts( "\n\n*** TEST 4 ***" ); + build_time( &time, 12, 31, 1988, 9, 15, 0, 0 ); + + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + + Extension_name[ 1 ] = rtems_build_name( 'E', 'X', 'T', ' ' ); + + status = rtems_extension_create( + Extension_name[ 1 ], + &Extensions, + &Extension_id[ 1 ] + ); + directive_failed( status, "rtems_extension_create" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + + Run_count[ 1 ] = 0; + Run_count[ 2 ] = 0; + Run_count[ 3 ] = 0; + + status = rtems_task_create( + Task_name[ 1 ], + 1, + 2048, + RTEMS_TIMESLICE, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_create( + Task_name[ 2 ], + 1, + 2048, + RTEMS_TIMESLICE, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create of TA2" ); + + status = rtems_task_create( + Task_name[ 3 ], + 1, + 2048, + RTEMS_TIMESLICE, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 3 ] + ); + directive_failed( status, "rtems_task_create of TA3" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_start( Task_id[ 2 ], Task_2, 0 ); + directive_failed( status, "rtems_task_start of TA2" ); + + status = rtems_task_start( Task_id[ 3 ], Task_3, 0 ); + directive_failed( status, "rtems_task_start of TA3" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/c/src/tests/sptests/sp04/sp04.doc b/c/src/tests/sptests/sp04/sp04.doc new file mode 100644 index 0000000000..6f6355abfa --- /dev/null +++ b/c/src/tests/sptests/sp04/sp04.doc @@ -0,0 +1,38 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test4 + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, + tm_set, tm_get, ev_receive, t_mode + +concepts: + + a. Verifies timeslicing ( all tasks are in timeslice mode ). + + b. Verifies the tswitch user extension. + + c. Verifies the no preemption mode. + + d. Verifies time-slice gets reset even if only one task ready. + +output: + The task name and the current time are printed out each time that a new + task is being dispatched. The configured timeslice is 100 ticks + ( 1 second ); therefore, a task name and the time are printed once + every second. After each task runs 3 times, task 1 changes its mode to + no preempt and runs for about 6 seconds and then changes its mode back to + preempt mode. diff --git a/c/src/tests/sptests/sp04/sp04.scn b/c/src/tests/sptests/sp04/sp04.scn new file mode 100644 index 0000000000..f104c0c482 --- /dev/null +++ b/c/src/tests/sptests/sp04/sp04.scn @@ -0,0 +1,24 @@ +*** TEST 4 *** +TA1 - 09:15:00 12/31/1988 +TA1 - rtems_task_suspend - on Task 2 +TA1 - rtems_task_suspend - on Task 3 +TA1 - killing time +TA1 - rtems_task_resume - on Task 2 +TA1 - rtems_task_resume - on Task 3 +TA2 - 09:15:03 12/31/1988 +TA3 - 09:15:04 12/31/1988 +TA1 - 09:15:05 12/31/1988 +TA2 - 09:15:06 12/31/1988 +TA3 - 09:15:07 12/31/1988 +TA1 - 09:15:08 12/31/1988 +TA1 - rtems_task_mode - change mode to NO RTEMS_PREEMPT +TA1 - 09:15:09 12/31/1988 +TA1 - 09:15:10 12/31/1988 +TA1 - 09:15:11 12/31/1988 +TA1 - 09:15:12 12/31/1988 +TA1 - 09:15:13 12/31/1988 +TA1 - 09:15:14 12/31/1988 +TA1 - rtems_task_mode - change mode to RTEMS_PREEMPT +TA2 - 09:15:15 12/31/1988 +TA3 - 09:15:16 12/31/1988 +*** END OF TEST 4 *** diff --git a/c/src/tests/sptests/sp04/system.h b/c/src/tests/sptests/sp04/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/c/src/tests/sptests/sp04/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/c/src/tests/sptests/sp04/task1.c b/c/src/tests/sptests/sp04/task1.c new file mode 100644 index 0000000000..8d0a620ec3 --- /dev/null +++ b/c/src/tests/sptests/sp04/task1.c @@ -0,0 +1,104 @@ +/* Task_1 + * + * This test serves as a test task. It verifies timeslicing activities + * and tswitch extension processing. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#include "clockdrv.h" + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_unsigned32 seconds; + rtems_unsigned32 old_seconds; + rtems_mode previous_mode; + rtems_time_of_day time; + rtems_status_code status; + rtems_unsigned32 start; + rtems_unsigned32 end; + + puts( "TA1 - rtems_task_suspend - on Task 2" ); + status = rtems_task_suspend( Task_id[ 2 ] ); + directive_failed( status, "rtems_task_suspend of TA2" ); + + puts( "TA1 - rtems_task_suspend - on Task 3" ); + status = rtems_task_suspend( Task_id[ 3 ] ); + directive_failed( status, "rtems_task_suspend of TA3" ); + + status = rtems_clock_get( RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH, &start ); + directive_failed( status, "rtems_clock_get" ); + + puts( "TA1 - killing time" ); + + for ( ; ; ) { + status = rtems_clock_get( RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH, &end ); + directive_failed( status, "rtems_clock_get" ); + + if ( end > (start + 2) ) + break; + } + + puts( "TA1 - rtems_task_resume - on Task 2" ); + status = rtems_task_resume( Task_id[ 2 ] ); + directive_failed( status, "rtems_task_resume of TA2" ); + + puts( "TA1 - rtems_task_resume - on Task 3" ); + status = rtems_task_resume( Task_id[ 3 ] ); + directive_failed( status, "rtems_task_resume of TA3" ); + + while ( FOREVER ) { + if ( Run_count[ 1 ] == 3 ) { + puts( "TA1 - rtems_task_mode - change mode to NO RTEMS_PREEMPT" ); + + status = rtems_task_mode( + RTEMS_NO_PREEMPT, + RTEMS_PREEMPT_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_get" ); + + old_seconds = time.second; + + for ( seconds = 0 ; seconds < 6 ; ) { + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_get" ); + + if ( time.second != old_seconds ) { + old_seconds = time.second; + seconds++; + print_time( "TA1 - ", &time, "\n" ); + } + } + + puts( "TA1 - rtems_task_mode - change mode to RTEMS_PREEMPT" ); + status = rtems_task_mode( + RTEMS_PREEMPT, + RTEMS_PREEMPT_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + + while ( FOREVER ); + } + } +} diff --git a/c/src/tests/sptests/sp04/task2.c b/c/src/tests/sptests/sp04/task2.c new file mode 100644 index 0000000000..7574e7dc9f --- /dev/null +++ b/c/src/tests/sptests/sp04/task2.c @@ -0,0 +1,29 @@ +/* Task_2 + * + * This routine serves as a test task. It is just a CPU bound task + * requiring timesliced operation. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_2( + rtems_task_argument argument +) +{ + while( FOREVER ); +} diff --git a/c/src/tests/sptests/sp04/task3.c b/c/src/tests/sptests/sp04/task3.c new file mode 100644 index 0000000000..a0e7482944 --- /dev/null +++ b/c/src/tests/sptests/sp04/task3.c @@ -0,0 +1,29 @@ +/* Task_3 + * + * This routine serves as a test task. It is just a CPU bound task + * requiring timesliced operation. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_3( + rtems_task_argument argument +) +{ + while( FOREVER ); +} diff --git a/c/src/tests/sptests/sp04/tswitch.c b/c/src/tests/sptests/sp04/tswitch.c new file mode 100644 index 0000000000..3f0c2047bc --- /dev/null +++ b/c/src/tests/sptests/sp04/tswitch.c @@ -0,0 +1,59 @@ +/* Task_switch + * + * This routine is the tswitch user extension. It determines which + * task is being switched to and displays a message indicating the + * time and date that it gained control. + * + * Input parameters: + * unused - pointer to currently running TCB + * heir - pointer to heir TCB + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_extension Task_switch( + rtems_tcb *unused, + rtems_tcb *heir +) +{ + rtems_unsigned32 index; + rtems_time_of_day time; + rtems_status_code status; + + index = task_number( heir->Object.id ); + + switch( index ) { + case 1: + case 2: + case 3: + Run_count[ index ] += 1; + + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_get" ); + + put_name( Task_name[ index ], FALSE ); + print_time( " - ", &time, "\n" ); + + if ( time.second >= 16 ) { + puts( "*** END OF TEST 4 ***" ); + exit( 0 ); + } + break; + + case 0: + default: + break; + } +} diff --git a/c/src/tests/sptests/sp05/init.c b/c/src/tests/sptests/sp05/init.c new file mode 100644 index 0000000000..2f6b8a6eac --- /dev/null +++ b/c/src/tests/sptests/sp05/init.c @@ -0,0 +1,84 @@ +/* Init + * + * This routine is the initialization task for this test program. + * It is a user initialization task and has the responsibility for creating + * and starting the tasks that make up the test. If the time of day + * clock is required for the test, it should also be set to a known + * value by this function. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TEST 5 ***" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_create( + Task_name[ 2 ], + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create of TA2" ); + + status = rtems_task_create( + Task_name[ 3 ], + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 3 ] + ); + directive_failed( status, "rtems_task_create of TA3" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_start( Task_id[ 2 ], Task_2, 0 ); + directive_failed( status, "rtems_task_start of TA2" ); + + status = rtems_task_start( Task_id[ 3 ], Task_3, 0 ); + directive_failed( status, "rtems_task_start of TA3" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/c/src/tests/sptests/sp05/sp05.doc b/c/src/tests/sptests/sp05/sp05.doc new file mode 100644 index 0000000000..583381a37e --- /dev/null +++ b/c/src/tests/sptests/sp05/sp05.doc @@ -0,0 +1,26 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test5 + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident + tm_wkafter, t_suspend, t_resume + +concepts: + + a. Verifies that a task can be suspended and resumed. + + b. Verifies that a task can suspend itself. diff --git a/c/src/tests/sptests/sp05/sp05.scn b/c/src/tests/sptests/sp05/sp05.scn new file mode 100644 index 0000000000..40afb2d4b2 --- /dev/null +++ b/c/src/tests/sptests/sp05/sp05.scn @@ -0,0 +1,47 @@ +*** TEST 5 *** +TA1 - rtems_task_wake_after - sleep 5 seconds +TA2 - rtems_task_suspend - suspend self +TA3 - rtems_task_suspend - suspend self +TA1 - rtems_task_suspend - suspend TA3 +TA1 - rtems_task_resume - resume TA2 +TA1 - rtems_task_wake_after - sleep 5 seconds +TA2 - rtems_task_wake_after - sleep 1 second +TA2 - rtems_task_wake_after - sleep 1 second +TA2 - rtems_task_wake_after - sleep 1 second +TA2 - rtems_task_wake_after - sleep 1 second +TA2 - rtems_task_wake_after - sleep 1 second +TA1 - rtems_task_suspend - suspend TA2 +TA1 - rtems_task_resume - resume TA3 +TA1 - rtems_task_wake_after - sleep 5 seconds +TA3 - rtems_task_wake_after - sleep 1 second +TA3 - rtems_task_wake_after - sleep 1 second +TA3 - rtems_task_wake_after - sleep 1 second +TA3 - rtems_task_wake_after - sleep 1 second +TA3 - rtems_task_wake_after - sleep 1 second +TA1 - rtems_task_suspend - suspend TA3 +TA1 - rtems_task_resume - resume TA2 +TA1 - rtems_task_wake_after - sleep 5 seconds +TA2 - rtems_task_wake_after - sleep 1 second +TA2 - rtems_task_wake_after - sleep 1 second +TA2 - rtems_task_wake_after - sleep 1 second +TA2 - rtems_task_wake_after - sleep 1 second +TA2 - rtems_task_wake_after - sleep 1 second +TA1 - rtems_task_suspend - suspend TA2 +TA1 - rtems_task_resume - resume TA3 +TA1 - rtems_task_wake_after - sleep 5 seconds +TA3 - rtems_task_wake_after - sleep 1 second +TA3 - rtems_task_wake_after - sleep 1 second +TA3 - rtems_task_wake_after - sleep 1 second +TA3 - rtems_task_wake_after - sleep 1 second +TA3 - rtems_task_wake_after - sleep 1 second +TA1 - rtems_task_suspend - suspend TA3 +TA1 - rtems_task_resume - resume TA2 +TA1 - rtems_task_wake_after - sleep 5 seconds +TA2 - rtems_task_wake_after - sleep 1 second +TA2 - rtems_task_wake_after - sleep 1 second +TA2 - rtems_task_wake_after - sleep 1 second +TA2 - rtems_task_wake_after - sleep 1 second +TA2 - rtems_task_wake_after - sleep 1 second +TA1 - rtems_task_suspend - suspend TA2 +TA1 - rtems_task_resume - resume TA3 +*** END OF TEST 5 *** diff --git a/c/src/tests/sptests/sp05/system.h b/c/src/tests/sptests/sp05/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/c/src/tests/sptests/sp05/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/c/src/tests/sptests/sp05/task1.c b/c/src/tests/sptests/sp05/task1.c new file mode 100644 index 0000000000..9b99586fc8 --- /dev/null +++ b/c/src/tests/sptests/sp05/task1.c @@ -0,0 +1,78 @@ +/* Task_1 + * + * This routine serves as a test task. It verifies that tasks can + * be suspended and resumed. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * NOTE: The rtems_task_suspend() directives fail on the first iteration. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_id tid2; + rtems_id tid3; + rtems_unsigned32 pass; + rtems_status_code status; + + status = rtems_task_ident( Task_name[ 2 ], 1, &tid2 ); + directive_failed( status, "rtems_task_ident of TA2" ); + + status = rtems_task_ident( Task_name[ 3 ], 1, &tid3 ); + directive_failed( status, "rtems_task_ident of TA3" ); + + for ( pass=1 ; pass <= 3 ; pass++ ) { + + puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" ); + status = rtems_task_wake_after( 5*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after of TA1" ); + + puts( "TA1 - rtems_task_suspend - suspend TA3" ); + status = rtems_task_suspend( tid3 ); + if ( pass == 1 ) { + fatal_directive_status( + status, + RTEMS_ALREADY_SUSPENDED, + "rtems_task_suspend of TA3" + ); + } else { + directive_failed( status, "rtems_task_suspend of TA3" ); + } + + puts( "TA1 - rtems_task_resume - resume TA2" ); + status = rtems_task_resume( tid2 ); + directive_failed( status, "rtems_task_resume of TA2" ); + + puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" ); + status = rtems_task_wake_after( 5*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "TA1 - rtems_task_suspend - suspend TA2" ); + status = rtems_task_suspend( tid2 ); + directive_failed( status, "rtems_task_suspend of TA2" ); + + puts( "TA1 - rtems_task_resume - resume TA3" ); + status = rtems_task_resume( tid3 ); + directive_failed( status, "rtems_task_resume" ); + } + + puts( "*** END OF TEST 5 ***" ); + exit( 0 ); +} diff --git a/c/src/tests/sptests/sp05/task2.c b/c/src/tests/sptests/sp05/task2.c new file mode 100644 index 0000000000..3878d8106d --- /dev/null +++ b/c/src/tests/sptests/sp05/task2.c @@ -0,0 +1,39 @@ +/* Task_2 + * + * This routine serves as a test task. Makes sure a task can suspend + * itself. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_2( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "TA2 - rtems_task_suspend - suspend self" ); + status = rtems_task_suspend( RTEMS_SELF ); + directive_failed( status, "rtems_task_suspend of TA2" ); + + while( FOREVER ) { + puts( "TA2 - rtems_task_wake_after - sleep 1 second" ); + status = rtems_task_wake_after( 1*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after of TA2" ); + } +} diff --git a/c/src/tests/sptests/sp05/task3.c b/c/src/tests/sptests/sp05/task3.c new file mode 100644 index 0000000000..c03c6de75b --- /dev/null +++ b/c/src/tests/sptests/sp05/task3.c @@ -0,0 +1,39 @@ +/* Task_3 + * + * This routine serves as a test task. Makes sure a task can suspend + * itself. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_3( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "TA3 - rtems_task_suspend - suspend self" ); + status = rtems_task_suspend( RTEMS_SELF ); + directive_failed( status, "rtems_task_suspend of TA3" ); + + while( FOREVER ) { + puts( "TA3 - rtems_task_wake_after - sleep 1 second" ); + status = rtems_task_wake_after( 1*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after of TA3" ); + } +} diff --git a/c/src/tests/sptests/sp06/init.c b/c/src/tests/sptests/sp06/init.c new file mode 100644 index 0000000000..08bab06594 --- /dev/null +++ b/c/src/tests/sptests/sp06/init.c @@ -0,0 +1,90 @@ +/* Init + * + * This routine is the initialization task for this test program. + * It is a user initialization task and has the responsibility for creating + * and starting the tasks that make up the test. If the time of day + * clock is required for the test, it should also be set to a known + * value by this function. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_task_priority previous_priority; + + puts( "\n\n*** TEST 6 ***" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + + Argument = 0; + Restart_argument = 1; + + status = rtems_task_create( + Task_name[ 1 ], + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_create( + Task_name[ 2 ], + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create of TA2" ); + + status = rtems_task_create( + Task_name[ 3 ], + 10, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 3 ] + ); + directive_failed( status, "rtems_task_create of TA3" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_start( Task_id[ 2 ], Task_2, Argument ); + directive_failed( status, "rtems_task_start of TA2" ); + + status = rtems_task_start( Task_id[ 3 ], Task_3, Argument ); + directive_failed( status, "rtems_task_start of TA3" ); + + status = rtems_task_set_priority( Task_id[ 3 ], 5, &previous_priority ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/c/src/tests/sptests/sp06/sp06.doc b/c/src/tests/sptests/sp06/sp06.doc new file mode 100644 index 0000000000..e8b96f1f6b --- /dev/null +++ b/c/src/tests/sptests/sp06/sp06.doc @@ -0,0 +1,26 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test6 + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, + tm_wkafter, t_restart + +concepts: + + a. Verifies that a task can restart a task other than itself. + + b. Verifies that a task can restart itself. diff --git a/c/src/tests/sptests/sp06/sp06.scn b/c/src/tests/sptests/sp06/sp06.scn new file mode 100644 index 0000000000..64f6489dc8 --- /dev/null +++ b/c/src/tests/sptests/sp06/sp06.scn @@ -0,0 +1,40 @@ +*** TEST 6 *** +TA1 - is beginning to run +TA1 - restarting TA3 +TA2 - is beginning to run +TA2 - rtems_task_wake_after - sleep 1/2 second +TA2 - rtems_task_wake_after - sleep 1/2 second +TA1 - rtems_task_restart - restarting TA2 +TA2 - is beginning to run +TA2 - rtems_task_wake_after - sleep 1/2 second +TA2 - rtems_task_wake_after - sleep 1/2 second +TA1 - rtems_task_restart - restarting self +TA1 - is beginning to run +TA2 - rtems_task_wake_after - sleep 1/2 second +TA2 - rtems_task_wake_after - sleep 1/2 second +TA1 - rtems_task_restart - restarting TA2 +TA2 - is beginning to run +TA2 - rtems_task_wake_after - sleep 1/2 second +TA2 - rtems_task_wake_after - sleep 1/2 second +TA1 - rtems_task_restart - restarting self +TA1 - is beginning to run +TA2 - rtems_task_wake_after - sleep 1/2 second +TA2 - rtems_task_wake_after - sleep 1/2 second +TA1 - rtems_task_restart - restarting TA2 +TA2 - is beginning to run +TA2 - rtems_task_wake_after - sleep 1/2 second +TA2 - rtems_task_wake_after - sleep 1/2 second +TA1 - rtems_task_restart - restarting self +TA1 - is beginning to run +TA2 - rtems_task_wake_after - sleep 1/2 second +TA2 - rtems_task_wake_after - sleep 1/2 second +TA1 - rtems_task_restart - restarting TA2 +TA2 - is beginning to run +TA2 - rtems_task_wake_after - sleep 1/2 second +TA2 - rtems_task_wake_after - sleep 1/2 second +TA1 - rtems_task_restart - restarting self +TA1 - is beginning to run +*** END OF TEST 6 *** + +NOTE: The prints from TA2 may not be as regular as indicated in the screen. + The important point is that TA2 is running and gets restarted. diff --git a/c/src/tests/sptests/sp06/system.h b/c/src/tests/sptests/sp06/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/c/src/tests/sptests/sp06/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/c/src/tests/sptests/sp06/task1.c b/c/src/tests/sptests/sp06/task1.c new file mode 100644 index 0000000000..6d0f67f395 --- /dev/null +++ b/c/src/tests/sptests/sp06/task1.c @@ -0,0 +1,61 @@ +/* Task_1 + * + * This task serves as a test task. Verifies that a task can restart + * both itself and other tasks. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_1( argument ) +rtems_unsigned32 argument; +{ + rtems_unsigned32 pass; + rtems_status_code status; + + puts( "TA1 - is beginning to run" ); + + pass = argument + 1; + + if ( pass == 5 ) { + puts( "*** END OF TEST 6 ***" ); + exit( 0 ); + } + + if ( pass == 1 ) { + puts( "TA1 - restarting TA3" ); + status = rtems_task_restart( Task_id[ 3 ], Restart_argument ); + directive_failed( status, "rtems_task_restart of TA3" ); + + status = rtems_task_wake_after( 2 * TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + } + + status = rtems_task_wake_after( TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "TA1 - rtems_task_restart - restarting TA2" ); + status = rtems_task_restart( Task_id[ 2 ], Restart_argument ); + directive_failed( status, "rtems_task_restart TA2" ); + + status = rtems_task_wake_after( 1*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "TA1 - rtems_task_restart - restarting self" ); + status = rtems_task_restart( Task_id[ 1 ], pass ); + directive_failed( status, "rtems_task_restart of RTEMS_SELF" ); +} diff --git a/c/src/tests/sptests/sp06/task2.c b/c/src/tests/sptests/sp06/task2.c new file mode 100644 index 0000000000..0c9e10bc07 --- /dev/null +++ b/c/src/tests/sptests/sp06/task2.c @@ -0,0 +1,40 @@ +/* Task_2 + * + * This routine serves as a test task. It simply runs forever so + * another task can restart it. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_2( argument ) +rtems_task_argument argument; +{ + rtems_status_code status; + + puts( "TA2 - is beginning to run" ); + if ( argument == Argument ) { + status = rtems_task_wake_after( 2 * TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + } + + while( FOREVER ) { + puts( "TA2 - rtems_task_wake_after - sleep 1/2 second" ); + status = rtems_task_wake_after( TICKS_PER_SECOND / 2 ); + directive_failed( status, "rtems_task_wake_after" ); + } +} diff --git a/c/src/tests/sptests/sp06/task3.c b/c/src/tests/sptests/sp06/task3.c new file mode 100644 index 0000000000..379ef8de92 --- /dev/null +++ b/c/src/tests/sptests/sp06/task3.c @@ -0,0 +1,32 @@ +/* Task_3 + * + * This routine serves as a test task. It is started, has its priority + * changed, and when it runs it deletes itself. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_3( + rtems_task_argument argument +) +{ + rtems_status_code status; + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/c/src/tests/sptests/sp07/init.c b/c/src/tests/sptests/sp07/init.c new file mode 100644 index 0000000000..f5d00eae8e --- /dev/null +++ b/c/src/tests/sptests/sp07/init.c @@ -0,0 +1,131 @@ +/* Init + * + * This routine is the initialization task for this test program. + * It is a user initialization task and has the responsibility for creating + * and starting the tasks that make up the test. If the time of day + * clock is required for the test, it should also be set to a known + * value by this function. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_extensions_table Extensions = { + Task_create_extension, /* task create user extension */ + Task_start_extension, /* task start user extension */ + Task_restart_extension, /* task restart user extension */ + Task_delete_extension, /* task delete user extension */ + NULL, /* task switch user extension */ + NULL, /* begin user extension */ + Task_exit_extension, /* task exitted user extension */ + NULL /* fatal error extension */ +}; + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TEST 7 ***" ); + + Extension_name[ 1 ] = rtems_build_name( 'E', 'X', 'T', ' ' ); + + status = rtems_extension_create( + Extension_name[ 1 ], + &Extensions, + &Extension_id[ 1 ] + ); + directive_failed( status, "rtems_extension_create" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_create( + Task_name[ 2 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create of TA2" ); + + status = rtems_task_create( + Task_name[ 3 ], + 250, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 3 ] + ); + directive_failed( status, "rtems_task_create of TA3" ); + + status = rtems_task_create( + Task_name[ 4 ], + 254, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 4 ] + ); + directive_failed( status, "rtems_task_create of TA4" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_start( Task_id[ 2 ], Task_2, 0 ); + directive_failed( status, "rtems_task_start of TA2" ); + + status = rtems_task_start( Task_id[ 3 ], Task_3, 0 ); + directive_failed( status, "rtems_task_start of TA3" ); + + status = rtems_task_start( Task_id[ 4 ], Task_4, 0 ); + directive_failed( status, "rtems_task_start of TA4" ); + + status = rtems_task_restart( Task_id[ 3 ], 0 ); + directive_failed( status, "rtems_task_restart of TA3" ); + + status = rtems_task_set_note( Task_id[ 1 ], RTEMS_NOTEPAD_8, 4 ); + directive_failed( status, "task_set_node of TA1" ); + printf( "INIT - rtems_task_set_note - set TA1's RTEMS_NOTEPAD_8 " ); + puts ( "to TA1's priority: 04" ); + + status = rtems_task_set_note( Task_id[ 2 ], RTEMS_NOTEPAD_8, 4 ); + directive_failed( status, "task_set_node of TA2" ); + printf( "INIT - rtems_task_set_note - set TA2's RTEMS_NOTEPAD_8 " ); + puts ( "to TA2's priority: 04"); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/c/src/tests/sptests/sp07/sp07.doc b/c/src/tests/sptests/sp07/sp07.doc new file mode 100644 index 0000000000..47411194c6 --- /dev/null +++ b/c/src/tests/sptests/sp07/sp07.doc @@ -0,0 +1,37 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test7 + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, + t_delete, t_setreg, t_getreg, t_setpri, t_suspend + +concepts: + + a. Verifies that tasks can communicate with each other via the + t_setreg and t_getreg directives. + + b. Verifies that the highest priority task is dispatched to execute. + + c. Verifies setting the priority of both a ready and a blocked task. + + d. Verifies the deletion of ready and blocked tasks. + + e. Verifies the tcreate user extension. + + f. Verifies the tstart user extension. + + g. Verifies the tdelete user extension. diff --git a/c/src/tests/sptests/sp07/sp07.scn b/c/src/tests/sptests/sp07/sp07.scn new file mode 100644 index 0000000000..1f6de2d93d --- /dev/null +++ b/c/src/tests/sptests/sp07/sp07.scn @@ -0,0 +1,33 @@ +*** TEST 7 *** +TASK_CREATE - TA1 - created. +TASK_CREATE - TA2 - created. +TASK_CREATE - TA3 - created. +TASK_CREATE - TA4 - created. +TASK_START - TA1 - started. +TASK_START - TA2 - started. +TASK_START - TA3 - started. +TASK_START - TA4 - started. +TASK_RESTART - TA3 - restarted. +INIT - rtems_task_set_note - set TA1's RTEMS_NOTEPAD_8 to TA1's priority: 04 +INIT - rtems_task_set_note - set TA2's RTEMS_NOTEPAD_8 to TA2's priority: 04 + +TA1 - rtems_task_set_priority - get initial priority of self: 04 +TA1 - rtems_task_get_note - get RTEMS_NOTEPAD_8 - current priority: 04 +TA1 - rtems_task_set_note - set TA2's RTEMS_NOTEPAD_8: 03 +TA1 - rtems_task_set_priority - set TA2's priority: 03 +TA2 - rtems_task_get_note - get RTEMS_NOTEPAD_8 - current priority: 03 +TA2 - rtems_task_set_note - set TA1's RTEMS_NOTEPAD_8: 02 +TA2 - rtems_task_set_priority - set TA1's priority: 02 +TA1 - rtems_task_get_note - get RTEMS_NOTEPAD_8 - current priority: 02 +TA1 - rtems_task_set_note - set TA2's RTEMS_NOTEPAD_8: 01 +TA1 - rtems_task_set_priority - set TA2's priority: 01 +TA2 - rtems_task_get_note - get RTEMS_NOTEPAD_8 - current priority: 01 +TA2 - rtems_task_suspend - suspend TA1 +TA2 - rtems_task_set_priority - set priority of TA1 ( blocked ) +TASK_DELETE - TA2 deleting TA1 +TASK_DELETE - TA2 deleting TA3 +TASK_DELETE - TA2 deleting TA2 +TA4 - exitting task +RTEMS_TASK_EXITTED - extension invoked for TA4 +*** END OF TEST 7 *** +TASK_DELETE - TA4 deleting TA4 <---- may not appear diff --git a/c/src/tests/sptests/sp07/system.h b/c/src/tests/sptests/sp07/system.h new file mode 100644 index 0000000000..01a3e7f765 --- /dev/null +++ b/c/src/tests/sptests/sp07/system.h @@ -0,0 +1,35 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* constants */ + +#define SI_NAME 0x53595349 /* name - "SYSI" */ +#define I_NAME 0x49444c45 /* name - "IDLE" */ + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/c/src/tests/sptests/sp07/task1.c b/c/src/tests/sptests/sp07/task1.c new file mode 100644 index 0000000000..62fa35cee9 --- /dev/null +++ b/c/src/tests/sptests/sp07/task1.c @@ -0,0 +1,85 @@ +/* Task_1 + * + * This routine serves as a test task. It verifies intertask communication + * using task notepads and verifies the the user extensions (tcreate, etc). + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_task_priority the_priority; + rtems_task_priority previous_priority; + + pause(); + + status = rtems_task_set_priority( + RTEMS_SELF, + RTEMS_CURRENT_PRIORITY, + &the_priority + ); + directive_failed( status, "rtems_task_set_priority" ); + printf( + "TA1 - rtems_task_set_priority - get initial priority of self: %02d\n", + the_priority + ); + + while( FOREVER ) { + status = rtems_task_get_note( RTEMS_SELF, RTEMS_NOTEPAD_8, &the_priority ); + directive_failed( status, "rtems_task_get_note" ); + printf( +"TA1 - rtems_task_get_note - get RTEMS_NOTEPAD_8 - current priority: %02d\n", + the_priority + ); + + if ( --the_priority == 0 ) { + puts( "TA1 - rtems_task_suspend - suspend TA2" ); + status = rtems_task_suspend( Task_id[ 2 ] ); + directive_failed( status, "rtems_task_suspend" ); + + puts( "TA1 - rtems_task_set_priority - set priority of TA2 ( blocked )" ); + status = rtems_task_set_priority( Task_id[ 2 ], 5, &previous_priority ); + directive_failed( status, "rtems_task_set_priority" ); + + status = rtems_task_delete( Task_id[ 2 ] ); + directive_failed( status, "rtems_task_delete of TA2" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); + } + + printf( "TA1 - rtems_task_set_note - set TA2's RTEMS_NOTEPAD_8: %02d\n", + the_priority + ); + status = rtems_task_set_note( Task_id[ 2 ], RTEMS_NOTEPAD_8, the_priority ); + directive_failed( status, "rtems_task_set_note" ); + + printf( "TA1 - rtems_task_set_priority - set TA2's priority: %02d\n", + the_priority + ); + status = rtems_task_set_priority( + Task_id[ 2 ], + the_priority, + &previous_priority + ); + directive_failed( status, "rtems_task_set_priority" ); + } +} diff --git a/c/src/tests/sptests/sp07/task2.c b/c/src/tests/sptests/sp07/task2.c new file mode 100644 index 0000000000..622bdd8e3d --- /dev/null +++ b/c/src/tests/sptests/sp07/task2.c @@ -0,0 +1,78 @@ +/* Task_2 + * + * This routine serves as a test task. Plays with priorities to verify + * that the highest priority task is always executed. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_2( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_task_priority the_priority; + rtems_task_priority previous_priority; + + while( FOREVER ) { + + status = rtems_task_get_note( RTEMS_SELF, RTEMS_NOTEPAD_8, &the_priority ); + directive_failed( status, "rtems_task_get_note" ); + printf( +"TA2 - rtems_task_get_note - get RTEMS_NOTEPAD_8 - current priority: %02d\n", + the_priority + ); + + if ( --the_priority == 0 ) { + puts( "TA2 - rtems_task_suspend - suspend TA1" ); + status = rtems_task_suspend( Task_id[ 1 ] ); + directive_failed( status, "rtems_task_suspend" ); + + puts( "TA2 - rtems_task_set_priority - set priority of TA1 ( blocked )" ); + status = rtems_task_set_priority( Task_id[ 1 ], 5, &previous_priority ); + directive_failed( status, "rtems_task_set_priority" ); + + status = rtems_task_delete( Task_id[ 1 ] ); /* TA1 is blocked */ + directive_failed( status, "rtems_task_delete of TA1" ); + + status = rtems_task_delete( Task_id[ 3 ] ); /* TA3 is ready */ + directive_failed( status, "rtems_task_delete of TA3" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of SELD" ); + + } else { + + printf( "TA2 - rtems_task_set_note - set TA1's RTEMS_NOTEPAD_8: %02d\n", + the_priority + ); + status = rtems_task_set_note(Task_id[ 1 ], RTEMS_NOTEPAD_8, the_priority); + directive_failed( status, "rtems_task_set_note" ); + + printf( "TA2 - rtems_task_set_priority - set TA1's priority: %02d\n", + the_priority + ); + status = rtems_task_set_priority( + Task_id[ 1 ], + the_priority, + &previous_priority + ); + directive_failed( status, "rtems_task_set_priority" ); + } + } +} diff --git a/c/src/tests/sptests/sp07/task3.c b/c/src/tests/sptests/sp07/task3.c new file mode 100644 index 0000000000..dce44b283b --- /dev/null +++ b/c/src/tests/sptests/sp07/task3.c @@ -0,0 +1,34 @@ +/* Task_3 + * + * This routine serves as a low priority test task that should never + * execute. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_3( + rtems_task_argument argument +) +{ + rtems_status_code status; + + while( FOREVER ) { + status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + directive_failed( status, "rtems_task_wake_after" ); + } +} diff --git a/c/src/tests/sptests/sp07/task4.c b/c/src/tests/sptests/sp07/task4.c new file mode 100644 index 0000000000..cc9de6d4c3 --- /dev/null +++ b/c/src/tests/sptests/sp07/task4.c @@ -0,0 +1,30 @@ +/* Task_4 + * + * This routine serves as a low priority test task that should exit + * a soon as it runs to test the taskexitted user extension. + * execute. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_4( + rtems_task_argument argument +) +{ + puts( "TA4 - exitting task" ); +} diff --git a/c/src/tests/sptests/sp07/taskexit.c b/c/src/tests/sptests/sp07/taskexit.c new file mode 100644 index 0000000000..ad52d1f3a7 --- /dev/null +++ b/c/src/tests/sptests/sp07/taskexit.c @@ -0,0 +1,33 @@ +/* Task_exit_extension + * + * This routine is the task exitted user extension. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_extension Task_exit_extension( + rtems_tcb *running_task +) +{ + if ( task_number( running_task->Object.id ) > 0 ) { + puts_nocr( "RTEMS_TASK_EXITTED - extension invoked for " ); + put_name( Task_name[ task_number( running_task->Object.id ) ], TRUE ); + } + + puts("*** END OF TEST 7 ***" ); + exit( 0 ); +} diff --git a/c/src/tests/sptests/sp07/tcreate.c b/c/src/tests/sptests/sp07/tcreate.c new file mode 100644 index 0000000000..7b066630f0 --- /dev/null +++ b/c/src/tests/sptests/sp07/tcreate.c @@ -0,0 +1,34 @@ +/* Task_create_extension + * + * This routine is the tcreate user extension. + * + * Input parameters: + * unused - pointer to currently running TCB + * created_task - pointer to new TCB being created + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_extension Task_create_extension( + rtems_tcb *unused, + rtems_tcb *created_task +) +{ + if ( task_number( created_task->Object.id ) > 0 ) { + puts_nocr( "TASK_CREATE - " ); + put_name( Task_name[ task_number( created_task->Object.id ) ], FALSE ); + puts( " - created." ); + } +} diff --git a/c/src/tests/sptests/sp07/tdelete.c b/c/src/tests/sptests/sp07/tdelete.c new file mode 100644 index 0000000000..9d7c5749c1 --- /dev/null +++ b/c/src/tests/sptests/sp07/tdelete.c @@ -0,0 +1,37 @@ +/* Task_delete_extension + * + * This routine is the delete user extension. + * + * Input parameters: + * running_task - pointer to running TCB + * deleted_task - pointer to TCB deleted + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_extension Task_delete_extension( + rtems_tcb *running_task, + rtems_tcb *deleted_task +) +{ + if ( task_number( running_task->Object.id ) > 0 ) { + puts_nocr( "TASK_DELETE - " ); + put_name( Task_name[ task_number( running_task->Object.id ) ], FALSE ); + } + if ( task_number( deleted_task->Object.id ) > 0 ) { + puts_nocr( " deleting " ); + put_name( Task_name[ task_number( deleted_task->Object.id ) ], TRUE ); + } +} diff --git a/c/src/tests/sptests/sp07/trestart.c b/c/src/tests/sptests/sp07/trestart.c new file mode 100644 index 0000000000..6cefb485a6 --- /dev/null +++ b/c/src/tests/sptests/sp07/trestart.c @@ -0,0 +1,34 @@ +/* Task_restart_extension + * + * This routine is the trestart user extension. + * + * Input parameters: + * unused - pointer to currently running TCB + * restarted_task - pointer to new TCB being started + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Task_restart_extension( + rtems_tcb *unused, + rtems_tcb *restarted_task +) +{ + if ( task_number( restarted_task->Object.id ) > 0 ) { + puts_nocr( "TASK_RESTART - " ); + put_name( Task_name[ task_number( restarted_task->Object.id ) ], FALSE ); + puts( " - restarted." ); + } +} diff --git a/c/src/tests/sptests/sp07/tstart.c b/c/src/tests/sptests/sp07/tstart.c new file mode 100644 index 0000000000..1b1fc795b7 --- /dev/null +++ b/c/src/tests/sptests/sp07/tstart.c @@ -0,0 +1,34 @@ +/* Task_start_extension + * + * This routine is the tstart user extension. + * + * Input parameters: + * unused - pointer to currently running TCB + * started_task - pointer to new TCB being started + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_extension Task_start_extension( + rtems_tcb *unused, + rtems_tcb *started_task +) +{ + if ( task_number( started_task->Object.id ) > 0 ) { + puts_nocr( "TASK_START - " ); + put_name( Task_name[ task_number( started_task->Object.id ) ], FALSE ); + puts( " - started." ); + } +} diff --git a/c/src/tests/sptests/sp08/init.c b/c/src/tests/sptests/sp08/init.c new file mode 100644 index 0000000000..e3020035ce --- /dev/null +++ b/c/src/tests/sptests/sp08/init.c @@ -0,0 +1,56 @@ +/* Init + * + * This routine is the initialization task for this test program. + * It is a user initialization task and has the responsibility for creating + * and starting the tasks that make up the test. If the time of day + * clock is required for the test, it should also be set to a known + * value by this function. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TEST 8 ***" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/c/src/tests/sptests/sp08/sp08.doc b/c/src/tests/sptests/sp08/sp08.doc new file mode 100644 index 0000000000..2b152779d7 --- /dev/null +++ b/c/src/tests/sptests/sp08/sp08.doc @@ -0,0 +1,26 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test8 + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, + t_mode + +concepts: + + a. Verifies every mode change possible. + + b. Verifies the fatal error handler. diff --git a/c/src/tests/sptests/sp08/sp08.scn b/c/src/tests/sptests/sp08/sp08.scn new file mode 100644 index 0000000000..d85ccc384f --- /dev/null +++ b/c/src/tests/sptests/sp08/sp08.scn @@ -0,0 +1,22 @@ +*** TEST 8 *** +TA1 - rtems_task_mode - RTEMS_ASR - previous mode: 00000000 +TA1 - rtems_task_mode - RTEMS_NO_ASR - previous mode: 00000000 +TA1 - rtems_task_mode - RTEMS_NO_ASR - previous mode: 00000400 +TA1 - rtems_task_mode - RTEMS_ASR - previous mode: 00000400 +TA1 - rtems_task_mode - RTEMS_NO_TIMESLICE - previous mode: 00000000 +TA1 - rtems_task_mode - RTEMS_TIMESLICE - previous mode: 00000000 +TA1 - rtems_task_mode - RTEMS_TIMESLICE - previous mode: 00000200 +TA1 - rtems_task_mode - RTEMS_NO_TIMESLICE - previous mode: 00000200 +TA1 - rtems_task_mode - RTEMS_PREEMPT - previous mode: 00000000 +TA1 - rtems_task_mode - RTEMS_NO_PREEMPT - previous mode: 00000000 +TA1 - rtems_task_mode - RTEMS_NO_PREEMPT - previous mode: 00000100 +TA1 - rtems_task_mode - RTEMS_PREEMPT - previous mode: 00000100 +TA1 - rtems_task_mode - RTEMS_INTERRUPT_LEVEL( 3 ) - previous mode: 00000000 +TA1 - rtems_task_mode - RTEMS_INTERRUPT_LEVEL( 5 ) - previous mode: 00000003 +TA1 - rtems_task_mode - set all modes - previous mode: 00000005 +TA1 - rtems_task_mode - set all modes - previous mode: 00000703 +TA1 - rtems_task_mode - clear all modes - previous mode: 00000703 +TA1 - rtems_task_mode - get current mode - previous mode: 00000000 +*** END OF TEST 8 *** + +NOTE: The interrupt level lines will be different on CPUs with few levels. diff --git a/c/src/tests/sptests/sp08/system.h b/c/src/tests/sptests/sp08/system.h new file mode 100644 index 0000000000..dec5151b46 --- /dev/null +++ b/c/src/tests/sptests/sp08/system.h @@ -0,0 +1,33 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +#define put_mode( _comment, _output_mode ) \ + printf( "%s %08x\n", _comment, _output_mode ); + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/c/src/tests/sptests/sp08/task1.c b/c/src/tests/sptests/sp08/task1.c new file mode 100644 index 0000000000..eddcb11191 --- /dev/null +++ b/c/src/tests/sptests/sp08/task1.c @@ -0,0 +1,256 @@ +/* Task_1 + * + * This routine serves as a test task. It verifies all combinations of + * task mode changes. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_mode previous_mode; + rtems_status_code status; + +/* BEGINNING OF RTEMS_ASR */ + + status = rtems_task_mode( RTEMS_ASR, RTEMS_ASR_MASK, &previous_mode ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_ASR - previous mode: ", + previous_mode + ); + + status = rtems_task_mode( + RTEMS_NO_ASR, + RTEMS_ASR_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_NO_ASR - previous mode: ", + previous_mode + ); + + status = rtems_task_mode( + RTEMS_NO_ASR, + RTEMS_ASR_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_NO_ASR - previous mode: ", + previous_mode + ); + + status = rtems_task_mode( + RTEMS_ASR, + RTEMS_ASR_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_ASR - previous mode: ", + previous_mode + ); + +/* END OF RTEMS_ASR */ + +/* BEGINNING OF RTEMS_TIMESLICE */ + + status = rtems_task_mode( + RTEMS_NO_TIMESLICE, + RTEMS_TIMESLICE_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_NO_TIMESLICE - previous mode: ", + previous_mode + ); + + status = rtems_task_mode( + RTEMS_TIMESLICE, + RTEMS_TIMESLICE_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_TIMESLICE - previous mode: ", + previous_mode + ); + + status = rtems_task_mode( + RTEMS_TIMESLICE, + RTEMS_TIMESLICE_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_TIMESLICE - previous mode: ", + previous_mode + ); + + status = rtems_task_mode( + RTEMS_NO_TIMESLICE, + RTEMS_TIMESLICE_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_NO_TIMESLICE - previous mode: ", + previous_mode + ); + +/* END OF RTEMS_TIMESLICE */ + +/* BEGINNING OF RTEMS_PREEMPT */ + + status = rtems_task_mode( + RTEMS_PREEMPT, + RTEMS_PREEMPT_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_PREEMPT - previous mode: ", + previous_mode + ); + + status = rtems_task_mode( + RTEMS_NO_PREEMPT, + RTEMS_PREEMPT_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_NO_PREEMPT - previous mode: ", + previous_mode + ); + + status = rtems_task_mode( + RTEMS_NO_PREEMPT, + RTEMS_PREEMPT_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_NO_PREEMPT - previous mode: ", + previous_mode + ); + + status = rtems_task_mode( + RTEMS_PREEMPT, + RTEMS_PREEMPT_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_PREEMPT - previous mode: ", + previous_mode + ); + +/* END OF RTEMS_PREEMPT */ + +/* BEGINNING OF RTEMS_INTERRUPT_LEVEL */ + + status = rtems_task_mode( + RTEMS_INTERRUPT_LEVEL(3), + RTEMS_INTERRUPT_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_INTERRUPT_LEVEL( 3 ) - previous mode: ", + previous_mode + ); + + status = rtems_task_mode( + RTEMS_INTERRUPT_LEVEL(5), + RTEMS_INTERRUPT_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - RTEMS_INTERRUPT_LEVEL( 5 ) - previous mode: ", + previous_mode + ); + +/* END OF RTEMS_INTERRUPT_LEVEL */ + +/* BEGINNING OF COMBINATIONS */ + + status = rtems_task_mode( + RTEMS_INTERRUPT_LEVEL(3) | RTEMS_NO_ASR | + RTEMS_TIMESLICE | RTEMS_NO_PREEMPT, + RTEMS_INTERRUPT_MASK | RTEMS_ASR_MASK | + RTEMS_TIMESLICE_MASK | RTEMS_PREEMPT_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - set all modes - previous mode: ", + previous_mode + ); + + status = rtems_task_mode( + RTEMS_INTERRUPT_LEVEL(3) | RTEMS_NO_ASR | + RTEMS_TIMESLICE | RTEMS_NO_PREEMPT, + RTEMS_INTERRUPT_MASK | RTEMS_ASR_MASK | + RTEMS_TIMESLICE_MASK | RTEMS_PREEMPT_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - set all modes - previous mode: ", + previous_mode + ); + + status = rtems_task_mode( + RTEMS_INTERRUPT_LEVEL(0) | RTEMS_ASR | RTEMS_NO_TIMESLICE | RTEMS_PREEMPT, + RTEMS_INTERRUPT_MASK | RTEMS_ASR_MASK | + RTEMS_TIMESLICE_MASK | RTEMS_PREEMPT_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - clear all modes - previous mode: ", + previous_mode + ); + +/* END OF COMBINATIONS */ + +/* BEGINNING OF CURRENT MODE */ + + status = rtems_task_mode( + RTEMS_CURRENT_MODE, + RTEMS_CURRENT_MODE, + &previous_mode + ); + directive_failed( status, "rtems_task_mode" ); + put_mode( + "TA1 - rtems_task_mode - get current mode - previous mode: ", + previous_mode + ); + +/* END OF CURRENT MODE */ + + puts( "*** END OF TEST 8 ***" ); + exit( 0 ); +} diff --git a/c/src/tests/sptests/sp09/delay.c b/c/src/tests/sptests/sp09/delay.c new file mode 100644 index 0000000000..dd78610be8 --- /dev/null +++ b/c/src/tests/sptests/sp09/delay.c @@ -0,0 +1,28 @@ +/* Delayed_routine + * + * This routine is used as the timer routine for Timer Manager tests. + * + * Input parameters: + * ignored - this parameter is ignored + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_timer_service_routine Delayed_routine( + rtems_id ignored_id, + void *ignored_address +) +{ +} diff --git a/c/src/tests/sptests/sp09/init.c b/c/src/tests/sptests/sp09/init.c new file mode 100644 index 0000000000..3ca4b62404 --- /dev/null +++ b/c/src/tests/sptests/sp09/init.c @@ -0,0 +1,123 @@ +/* Init + * + * This routine is the initialization task for this test program. + * It is a user initialization task and has the responsibility for creating + * and starting the tasks that make up the test. If the time of day + * clock is required for the test, it should also be set to a known + * value by this function. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TEST 9 ***" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' ); + Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' ); + Task_name[ 6 ] = rtems_build_name( 'T', 'A', '6', ' ' ); + Task_name[ 7 ] = rtems_build_name( 'T', 'A', '7', ' ' ); + Task_name[ 8 ] = rtems_build_name( 'T', 'A', '8', ' ' ); + Task_name[ 9 ] = rtems_build_name( 'T', 'A', '9', ' ' ); + Task_name[ 10 ] = rtems_build_name( 'T', 'A', 'A', ' ' ); + + Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' ); + + Semaphore_name[ 1 ] = rtems_build_name( 'S', 'M', '1', ' ' ); + Semaphore_name[ 2 ] = rtems_build_name( 'S', 'M', '2', ' ' ); + Semaphore_name[ 3 ] = rtems_build_name( 'S', 'M', '3', ' ' ); + + Queue_name[ 1 ] = rtems_build_name( 'M', 'Q', '1', ' ' ); + Queue_name[ 2 ] = rtems_build_name( 'M', 'Q', '2', ' ' ); + + Partition_name[ 1 ] = rtems_build_name( 'P', 'T', '1', ' ' ); + + Region_name[ 1 ] = rtems_build_name( 'R', 'N', '1', ' ' ); + + Port_name[ 1 ] = rtems_build_name( 'D', 'P', '1', ' ' ); + + Period_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' ); + +#if 0 + status = rtems_task_create( + Task_name[1], + 4, + 10, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + fatal_directive_status( + status, + RTEMS_INVALID_SIZE, + "rtems_task_create with illegal stack size" + ); + puts( "INIT - rtems_task_create - RTEMS_INVALID_SIZE" ); +#endif + puts( "INIT - rtems_task_create - RTEMS_INVALID_SIZE -- NOT CHECKED" ); + + status = rtems_task_create( + Task_name[1], + 0, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + fatal_directive_status( + status, + RTEMS_INVALID_PRIORITY, + "rtems_task_create with illegal priority" + ); + puts( "INIT - rtems_task_create - RTEMS_INVALID_PRIORITY" ); + + status = rtems_task_create( + Task_name[ 1 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_restart( Task_id[ 1 ], 0 ); + fatal_directive_status( + status, + RTEMS_INCORRECT_STATE, + "rtems_task_restart of DORMANT task" + ); + puts( "INIT - rtems_task_restart - RTEMS_INCORRECT_STATE" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/c/src/tests/sptests/sp09/isr.c b/c/src/tests/sptests/sp09/isr.c new file mode 100644 index 0000000000..292e9c0225 --- /dev/null +++ b/c/src/tests/sptests/sp09/isr.c @@ -0,0 +1,27 @@ +/* Service_routine + * + * This routine is used as the timer routine for Interrupt Manager tests. + * + * Input parameters: + * ignored - this parameter is ignored + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_isr Service_routine( + rtems_vector_number ignored +) +{ +} diff --git a/c/src/tests/sptests/sp09/screen01.c b/c/src/tests/sptests/sp09/screen01.c new file mode 100644 index 0000000000..39012f5051 --- /dev/null +++ b/c/src/tests/sptests/sp09/screen01.c @@ -0,0 +1,168 @@ +/* Screen1 + * + * This routine generates error screen 1 for test 9. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Screen1() +{ + rtems_unsigned32 notepad_value; + rtems_id self_id; + rtems_task_priority previous_priority; + rtems_status_code status; + + status = rtems_task_delete( 100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_task_delete with illegal id" + ); + puts( "TA1 - rtems_task_delete - RTEMS_INVALID_ID" ); + + status = rtems_task_get_note( RTEMS_SELF, 100, ¬epad_value ); + fatal_directive_status( + status, + RTEMS_INVALID_NUMBER, + "rtems_task_get_note with illegal notepad" + ); + puts( "TA1 - rtems_task_get_note - RTEMS_INVALID_NUMBER" ); + + status = rtems_task_get_note( 100, RTEMS_NOTEPAD_LAST, ¬epad_value ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_task_get_note with illegal id" + ); + puts( "TA1 - rtems_task_get_note - RTEMS_INVALID_ID" ); + + status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &self_id ); + directive_failed( status, "rtems_task_ident of self" ); + + if ( self_id != Task_id[ 1 ] ) { + puts( "ERROR - rtems_task_ident - incorrect ID returned!" ); + } + puts( "TA1 - rtems_task_ident - current task RTEMS_SUCCESSFUL" ); + + status = rtems_task_ident( 100, RTEMS_SEARCH_ALL_NODES, &Junk_id ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_task_ident with illegal name (local)" + ); + puts( "TA1 - rtems_task_ident - global RTEMS_INVALID_NAME" ); + + status = rtems_task_ident( 100, 1, &Junk_id ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_task_ident with illegal name (global)" + ); + puts( "TA1 - rtems_task_ident - local RTEMS_INVALID_NAME" ); + + status = rtems_task_ident( 100, 2, &Junk_id ); + fatal_directive_status( + status, + RTEMS_INVALID_NODE, + "rtems_task_ident with illegal node" + ); + puts( "TA1 - rtems_task_ident - RTEMS_INVALID_NODE" ); + + status = rtems_task_restart( 100, 0 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_task_restart with illegal id" + ); + puts( "TA1 - rtems_task_restart - RTEMS_INVALID_ID" ); + + status = rtems_task_resume( 100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_task_resume with illegal id" + ); + puts( "TA1 - rtems_task_resume - RTEMS_INVALID_ID" ); + + status = rtems_task_resume( RTEMS_SELF ); + fatal_directive_status( + status, + RTEMS_INCORRECT_STATE, + "rtems_task_resume of ready task" + ); + puts( "TA1 - rtems_task_resume - RTEMS_INCORRECT_STATE" ); + + status = rtems_task_set_priority( RTEMS_SELF, 512, &previous_priority ); + fatal_directive_status( + status, + RTEMS_INVALID_PRIORITY, + "rtems_task_set_priority with illegal priority" + ); + puts( "TA1 - rtems_task_set_priority - RTEMS_INVALID_PRIORITY" ); + + status = rtems_task_set_priority( 100, 8, &previous_priority ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_task_set_priority with illegal id" + ); + puts( "TA1 - rtems_task_set_priority - RTEMS_INVALID_ID" ); + + status = rtems_task_set_note( + RTEMS_SELF, + RTEMS_NOTEPAD_LAST+10, + notepad_value + ); + fatal_directive_status( + status, + RTEMS_INVALID_NUMBER, + "rtems_task_set_note with illegal notepad" + ); + puts( "TA1 - rtems_task_set_note - RTEMS_INVALID_NUMBER" ); + + status = rtems_task_set_note( 100, RTEMS_NOTEPAD_LAST, notepad_value ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_task_set_note with illegal id" + ); + puts( "TA1 - rtems_task_set_note - RTEMS_INVALID_ID" ); + + status = rtems_task_start( 100, Task_1, 0 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_task_start with illegal id" + ); + puts( "TA1 - rtems_task_start - RTEMS_INVALID_ID" ); + + status = rtems_task_start( 0, Task_1, 0 ); + fatal_directive_status( + status, + RTEMS_INCORRECT_STATE, + "rtems_task_start of ready task" + ); + puts( "TA1 - rtems_task_start - RTEMS_INCORRECT_STATE" ); + + status = rtems_task_suspend( 100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_task_suspend with illegal id" + ); + puts( "TA1 - rtems_task_suspend - RTEMS_INVALID_ID" ); +} diff --git a/c/src/tests/sptests/sp09/screen02.c b/c/src/tests/sptests/sp09/screen02.c new file mode 100644 index 0000000000..02eb5e4498 --- /dev/null +++ b/c/src/tests/sptests/sp09/screen02.c @@ -0,0 +1,192 @@ +/* Screen2 + * + * This routine generates error screen 2 for test 9. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Screen2() +{ + rtems_time_of_day time; + rtems_status_code status; + +/* errors before clock is set */ + + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + if ( status == RTEMS_SUCCESSFUL ) { + puts( + "TA1 - rtems_clock_get - RTEMS_NOT_DEFINED -- DID BSP SET THE TIME OF DAY?" + ); + } else { + fatal_directive_status( + status, + RTEMS_NOT_DEFINED, + "rtems_clock_get before clock is set" + ); + puts( "TA1 - rtems_clock_get - RTEMS_NOT_DEFINED" ); + } + + status = rtems_task_wake_when( &time ); + if ( status == RTEMS_SUCCESSFUL ) { + puts( +"TA1 - rtems_task_wake_when - RTEMS_NOT_DEFINED -- DID BSP SET THE TIME OF DAY?" + ); + } else { + fatal_directive_status( + status, + RTEMS_NOT_DEFINED, + "rtems_task_wake_when before clock is set" + ); + puts( "TA1 - rtems_task_wake_when - RTEMS_NOT_DEFINED" ); + } + + status = rtems_timer_fire_when( 0, &time, Delayed_routine, NULL ); + if ( status == RTEMS_SUCCESSFUL ) { + puts( + "TA1 - timer_wake_when - RTEMS_NOT_DEFINED -- DID BSP SET THE TIME OF DAY?" + ); + } else { + fatal_directive_status( + status, + RTEMS_NOT_DEFINED, + "task_fire_when before clock is set" + ); + puts( "TA1 - rtems_timer_fire_when - RTEMS_NOT_DEFINED" ); + } + + build_time( &time, 2, 5, 1987, 8, 30, 45, 0 ); + print_time( "TA1 - rtems_clock_set - ", &time, "" ); + status = rtems_clock_set( &time ); + fatal_directive_status( + status, + RTEMS_INVALID_CLOCK, + "rtems_clock_set with invalid year" + ); + puts( " - RTEMS_INVALID_CLOCK" ); + + build_time( &time, 15, 5, 1988, 8, 30, 45, 0 ); + print_time( "TA1 - rtems_clock_set - ", &time, "" ); + status = rtems_clock_set( &time ); + fatal_directive_status( + status, + RTEMS_INVALID_CLOCK, + "rtems_clock_set with invalid month" + ); + puts( " - RTEMS_INVALID_CLOCK" ); + + build_time( &time, 2, 32, 1988, 8, 30, 45, 0 ); + print_time( "TA1 - rtems_clock_set - ", &time, "" ); + status = rtems_clock_set( &time ); + fatal_directive_status( + status, + RTEMS_INVALID_CLOCK, + "rtems_clock_set with invalid day" + ); + puts( " - RTEMS_INVALID_CLOCK" ); + + build_time( &time, 2, 5, 1988, 25, 30, 45, 0 ); + print_time( "TA1 - rtems_clock_set - ", &time, "" ); + status = rtems_clock_set( &time ); + fatal_directive_status( + status, + RTEMS_INVALID_CLOCK, + "rtems_clock_set with invalid hour" + ); + puts( " - RTEMS_INVALID_CLOCK" ); + + build_time( &time, 2, 5, 1988, 8, 61, 45, 0 ); + print_time( "TA1 - rtems_clock_set - ", &time, "" ); + status = rtems_clock_set( &time ); + fatal_directive_status( + status, + RTEMS_INVALID_CLOCK, + "rtems_clock_set with invalid minute" + ); + puts( " - RTEMS_INVALID_CLOCK" ); + + build_time( &time, 2, 5, 1988, 8, 30, 61, 0 ); + print_time( "TA1 - rtems_clock_set - ", &time, "" ); + status = rtems_clock_set( &time ); + fatal_directive_status( + status, + RTEMS_INVALID_CLOCK, + "rtems_clock_set with invalid second" + ); + puts( " - RTEMS_INVALID_CLOCK" ); + + build_time( &time, 2, 5, 1988, 8, 30, 45, TICKS_PER_SECOND + 1 ); + print_time( "TA1 - rtems_clock_set - ", &time, "" ); + status = rtems_clock_set( &time ); + fatal_directive_status( + status, + RTEMS_INVALID_CLOCK, + "rtems_clock_set with invalid ticks per second" + ); + puts( " - RTEMS_INVALID_CLOCK" ); + + build_time( &time, 2, 5, 1988, 8, 30, 45, 0 ); + print_time( "TA1 - rtems_clock_set - ", &time, "" ); + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set successful" ); + puts( " - RTEMS_SUCCESSFUL" ); + +/* rtems_task_wake_when */ + + build_time( &time, 2, 5, 1988, 8, 30, 48, TICKS_PER_SECOND + 1 ); + time.second += 3; + puts( "TA1 - rtems_task_wake_when - TICKINVALID - sleep about 3 seconds" ); + + status = rtems_task_wake_when( &time ); + directive_failed( + status, + "rtems_task_wake_when with invalid ticks per second" + ); + puts( "TA1 - rtems_task_wake_when - TICKINVALID - woke up RTEMS_SUCCESSFUL" ); + + build_time( &time, 2, 5, 1961, 8, 30, 48, 0 ); + print_time( "TA1 - rtems_task_wake_when - ", &time, "" ); + status = rtems_task_wake_when( &time ); + fatal_directive_status( + status, + RTEMS_INVALID_CLOCK, + "rtems_task_wake_when with invalid year" + ); + puts( " - RTEMS_INVALID_CLOCK" ); + + build_time( &time, 2, 5, 1988, 25, 30, 48, 0 ); + print_time( "TA1 - rtems_task_wake_when - ", &time, "" ); + status = rtems_task_wake_when( &time ); + fatal_directive_status( + status, + RTEMS_INVALID_CLOCK, + "rtems_task_wake_when with invalid hour" + ); + puts( " - RTEMS_INVALID_CLOCK" ); + + rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + print_time( "TA1 - current time - ", &time, "\n" ); + + time.month = 1; + print_time( "TA1 - rtems_task_wake_when - ", &time, "" ); + status = rtems_task_wake_when( &time ); + fatal_directive_status( + status, + RTEMS_INVALID_CLOCK, + "rtems_task_wake_when before current time" + ); + puts( " - RTEMS_INVALID_CLOCK" ); +} diff --git a/c/src/tests/sptests/sp09/screen03.c b/c/src/tests/sptests/sp09/screen03.c new file mode 100644 index 0000000000..7f431c45df --- /dev/null +++ b/c/src/tests/sptests/sp09/screen03.c @@ -0,0 +1,204 @@ +/* Screen3 + * + * This routine generates error screen 3 for test 9. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +extern rtems_configuration_table BSP_Configuration; + +void Screen3() +{ + rtems_name task_name; + rtems_status_code status; + + task_name = 1; + status = rtems_task_create( + 0, + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_task_create with illegal name" + ); + puts( "TA1 - rtems_task_create - RTEMS_INVALID_NAME" ); + + status = rtems_task_create( + task_name, + 1, + BSP_Configuration.work_space_size, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_UNSATISFIED, + "rtems_task_create with a stack size larger than the workspace" + ); + puts( "TA1 - rtems_task_create - stack size - RTEMS_UNSATISFIED" ); + + status = rtems_task_create( + Task_name[ 2 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create of TA2" ); + puts( "TA1 - rtems_task_create - TA2 created - RTEMS_SUCCESSFUL" ); + + status = rtems_task_suspend( Task_id[ 2 ] ); + directive_failed( status, "rtems_task_suspend of TA2" ); + puts( "TA1 - rtems_task_suspend - suspend TA2 - RTEMS_SUCCESSFUL" ); + + status = rtems_task_suspend( Task_id[ 2 ] ); + fatal_directive_status( + status, + RTEMS_ALREADY_SUSPENDED, + "rtems_task_suspend of suspended TA2" + ); + puts( "TA1 - rtems_task_suspend - suspend TA2 - RTEMS_ALREADY_SUSPENDED" ); + + status = rtems_task_resume( Task_id[ 2 ] ); + directive_failed( status, "rtems_task_resume of TA2" ); + puts( "TA1 - rtems_task_resume - TA2 resumed - RTEMS_SUCCESSFUL" ); + + status = rtems_task_create( + Task_name[ 3 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 3 ] + ); + directive_failed( status, "rtems_task_create of TA3" ); + puts( "TA1 - rtems_task_create - TA3 created - RTEMS_SUCCESSFUL" ); + + status = rtems_task_create( + Task_name[ 4 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 4 ] + ); + directive_failed( status, "rtems_task_create of TA4" ); + puts( "TA1 - rtems_task_create - 4 created - RTEMS_SUCCESSFUL" ); + + status = rtems_task_create( + Task_name[ 5 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 5 ] + ); + directive_failed( status, "rtems_task_create of TA5" ); + puts( "TA1 - rtems_task_create - 5 created - RTEMS_SUCCESSFUL" ); + + status = rtems_task_create( + Task_name[ 6 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 6 ] + ); + directive_failed( status, "rtems_task_create of TA6" ); + puts( "TA1 - rtems_task_create - 6 created - RTEMS_SUCCESSFUL" ); + + status = rtems_task_create( + Task_name[ 7 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 7 ] + ); + directive_failed( status, "rtems_task_create of TA7" ); + puts( "TA1 - rtems_task_create - 7 created - RTEMS_SUCCESSFUL" ); + + status = rtems_task_create( + Task_name[ 8 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 8 ] + ); + directive_failed( status, "rtems_task_create of TA8" ); + puts( "TA1 - rtems_task_create - 8 created - RTEMS_SUCCESSFUL" ); + + status = rtems_task_create( + Task_name[ 9 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 9 ] + ); + directive_failed( status, "rtems_task_create of TA9" ); + puts( "TA1 - rtems_task_create - 9 created - RTEMS_SUCCESSFUL" ); + + status = rtems_task_create( + Task_name[ 10 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 10 ] + ); + directive_failed( status, "rtems_task_create of TA10" ); + puts( "TA1 - rtems_task_create - 10 created - RTEMS_SUCCESSFUL" ); + + status = rtems_task_create( + task_name, + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_TOO_MANY, + "rtems_task_create for too many tasks" + ); + puts( "TA1 - rtems_task_create - 11 - RTEMS_TOO_MANY" ); + + status = rtems_task_create( + task_name, + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_GLOBAL, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_MP_NOT_CONFIGURED, + "rtems_task_create of global task in a single cpu system" + ); + puts( "TA1 - rtems_task_create - RTEMS_MP_NOT_CONFIGURED" ); +} diff --git a/c/src/tests/sptests/sp09/screen04.c b/c/src/tests/sptests/sp09/screen04.c new file mode 100644 index 0000000000..6e3866cb05 --- /dev/null +++ b/c/src/tests/sptests/sp09/screen04.c @@ -0,0 +1,85 @@ +/* Screen4 + * + * This routine generates error screen 4 for test 9. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Screen4() +{ + rtems_event_set event_out; + rtems_time_of_day time; + rtems_status_code status; + + status = rtems_event_receive( + RTEMS_EVENT_16, + RTEMS_NO_WAIT, + RTEMS_NO_TIMEOUT, + &event_out + ); + fatal_directive_status( + status, + RTEMS_UNSATISFIED, + "rtems_event_receive unsatisfied (ALL)" + ); + puts( "TA1 - rtems_event_receive - RTEMS_UNSATISFIED ( all conditions )" ); + + status = rtems_event_receive( + RTEMS_EVENT_16, + RTEMS_EVENT_ANY | RTEMS_NO_WAIT, + RTEMS_NO_TIMEOUT, + &event_out + ); + fatal_directive_status( + status, + RTEMS_UNSATISFIED, + "rtems_event_receive unsatisfied (ANY)" + ); + puts( "TA1 - rtems_event_receive - RTEMS_UNSATISFIED ( any condition )" ); + + puts( "TA1 - rtems_event_receive - timeout in 3 seconds" ); + status = rtems_event_receive( + RTEMS_EVENT_16, + RTEMS_DEFAULT_OPTIONS, + 3 * TICKS_PER_SECOND, + &event_out + ); + fatal_directive_status( + status, + RTEMS_TIMEOUT, + "rtems_event_receive" + ); + puts( "TA1 - rtems_event_receive - woke up with RTEMS_TIMEOUT" ); + + status = rtems_event_send( 100, RTEMS_EVENT_16 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_event_send with illegal id" + ); + puts( "TA1 - rtems_event_send - RTEMS_INVALID_ID" ); + + puts( "TA1 - rtems_task_wake_after - sleep 1 second - RTEMS_SUCCESSFUL" ); + status = rtems_task_wake_after( TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + build_time( &time, 2, 5, 1988, 8, 30, 45, 0 ); + print_time( "TA1 - rtems_clock_set - ", &time, "" ); + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + puts( " - RTEMS_SUCCESSFUL" ); +} diff --git a/c/src/tests/sptests/sp09/screen05.c b/c/src/tests/sptests/sp09/screen05.c new file mode 100644 index 0000000000..9b091a407a --- /dev/null +++ b/c/src/tests/sptests/sp09/screen05.c @@ -0,0 +1,148 @@ +/* Screen5 + * + * This routine generates error screen 5 for test 9. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Screen5() +{ + rtems_status_code status; + + status = rtems_semaphore_create( 0, 1, RTEMS_DEFAULT_ATTRIBUTES, &Junk_id ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_semaphore_create with illegal name" + ); + puts( "TA1 - rtems_semaphore_create - RTEMS_INVALID_NAME" ); + + status = rtems_semaphore_create( + Semaphore_name[ 1 ], + 1, + RTEMS_DEFAULT_ATTRIBUTES, + &Semaphore_id[ 1 ] + ); + directive_failed( status, "rtems_semaphore_create" ); + puts( "TA1 - rtems_semaphore_create - 1 - RTEMS_SUCCESSFUL" ); + + status = rtems_semaphore_create( + Semaphore_name[ 2 ], + 1, + RTEMS_BINARY_SEMAPHORE, + &Semaphore_id[ 2 ] + ); + directive_failed( status, "rtems_semaphore_create" ); + puts( "TA1 - rtems_semaphore_create - 2 - RTEMS_SUCCESSFUL" ); + + status = rtems_semaphore_create( + Semaphore_name[ 3 ], + 1, + RTEMS_DEFAULT_ATTRIBUTES, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_TOO_MANY, + "rtems_semaphore_create of too many" + ); + puts( "TA1 - rtems_semaphore_create - 3 - RTEMS_TOO_MANY" ); + + status = rtems_semaphore_create( + Semaphore_name[ 1 ], + 1, + RTEMS_INHERIT_PRIORITY | RTEMS_BINARY_SEMAPHORE | RTEMS_FIFO, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_NOT_DEFINED, + "rtems_semaphore_create of RTEMS_FIFO RTEMS_INHERIT_PRIORITY" + ); + puts( "TA1 - rtems_semaphore_create - RTEMS_NOT_DEFINED" ); + + status = rtems_semaphore_create( + Semaphore_name[ 1 ], + 1, + RTEMS_INHERIT_PRIORITY | RTEMS_COUNTING_SEMAPHORE | RTEMS_PRIORITY, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_NOT_DEFINED, + "rtems_semaphore_create of RTEMS_COUNTING_SEMAPHORE RTEMS_INHERIT_PRIORITY" + ); + puts( "TA1 - rtems_semaphore_create - RTEMS_NOT_DEFINED" ); + + status = rtems_semaphore_create( + Semaphore_name[ 1 ], + 2, + RTEMS_BINARY_SEMAPHORE, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_INVALID_NUMBER, + "rtems_semaphore_create of binary semaphore with count > 1" + ); + puts( "TA1 - rtems_semaphore_create - RTEMS_INVALID_NUMBER" ); + + status = rtems_semaphore_create( + Semaphore_name[ 3 ], + 1, + RTEMS_GLOBAL, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_MP_NOT_CONFIGURED, + "rtems_semaphore_create of mp not configured" + ); + puts( "TA1 - rtems_semaphore_create - RTEMS_MP_NOT_CONFIGURED" ); + + status = rtems_semaphore_delete( 100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_semaphore_delete with illegal id" + ); + puts( "TA1 - rtems_semaphore_delete - unknown RTEMS_INVALID_ID" ); + + status = rtems_semaphore_delete( 0x010100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_semaphore_delete with local illegal id" + ); + puts( "TA1 - rtems_semaphore_delete - local RTEMS_INVALID_ID" ); + + status = rtems_semaphore_ident( 100, RTEMS_SEARCH_ALL_NODES, &Junk_id ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_semaphore_ident will illegal name (local)" + ); + puts( "TA1 - rtems_semaphore_ident - global RTEMS_INVALID_NAME" ); + + status = rtems_semaphore_ident( 100, 1, &Junk_id ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_semaphore_ident will illegal name (global)" + ); + puts( "TA1 - rtems_semaphore_ident - local RTEMS_INVALID_NAME" ); +} diff --git a/c/src/tests/sptests/sp09/screen06.c b/c/src/tests/sptests/sp09/screen06.c new file mode 100644 index 0000000000..40ad75d606 --- /dev/null +++ b/c/src/tests/sptests/sp09/screen06.c @@ -0,0 +1,125 @@ +/* Screen6 + * + * This routine generates error screen 6 for test 9. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Screen6() +{ + rtems_status_code status; + + status = rtems_semaphore_obtain( + 100, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_semaphore_obtain with illegal id" + ); + puts( "TA1 - rtems_semaphore_obtain - RTEMS_INVALID_ID" ); + + status = rtems_semaphore_obtain( + Semaphore_id[ 1 ], + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_semaphore_obtain successful" ); + puts( "TA1 - rtems_semaphore_obtain - got sem 1 - RTEMS_SUCCESSFUL" ); + + status = rtems_semaphore_obtain( + Semaphore_id[ 1 ], + RTEMS_NO_WAIT, + RTEMS_NO_TIMEOUT + ); + fatal_directive_status( + status, + RTEMS_UNSATISFIED, + "rtems_semaphore_obtain not available" + ); + puts( "TA1 - rtems_semaphore_obtain - RTEMS_UNSATISFIED" ); + + puts( "TA1 - rtems_semaphore_obtain - timeout in 3 seconds" ); + status = rtems_semaphore_obtain( + Semaphore_id[ 1 ], + RTEMS_DEFAULT_OPTIONS, + 3 * TICKS_PER_SECOND + ); + fatal_directive_status( + status, + RTEMS_TIMEOUT, + "rtems_semaphore_obtain timeout" + ); + puts( "TA1 - rtems_semaphore_obtain - woke up with RTEMS_TIMEOUT" ); + + status = rtems_semaphore_release( Semaphore_id[ 2 ] ); + fatal_directive_status( + status, + RTEMS_NOT_OWNER_OF_RESOURCE, + "rtems_semaphore_release and not owner" + ); + puts( "TA1 - rtems_semaphore_release - RTEMS_NOT_OWNER_OF_RESOURCE" ); + + status = rtems_semaphore_release( 100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_semaphore_release with illegal id" + ); + puts( "TA1 - rtems_semaphore_release - RTEMS_INVALID_ID" ); + + puts( "TA1 - rtems_task_start - start TA2 - RTEMS_SUCCESSFUL" ); + status = rtems_task_start( Task_id[ 2 ], Task_2, 0 ); + directive_failed( status, "rtems_task_start of TA2" ); + + puts( "TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL" ); + status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + directive_failed( status, "rtems_task_wake_after (yield)" ); + + puts( "TA1 - rtems_semaphore_delete - delete sem 1 - RTEMS_SUCCESSFUL" ); + status = rtems_semaphore_delete( Semaphore_id[ 1 ] ); + directive_failed( status, "rtems_semaphore_delete of SM1" ); + + puts( "TA1 - rtems_semaphore_obtain - binary semaphore" ); + status = rtems_semaphore_obtain( + Semaphore_id[ 2 ], + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_semaphore_obtain"); + + puts( "TA1 - rtems_semaphore_delete - delete sem 2 - RTEMS_RESOURCE_IN_USE" ); + status = rtems_semaphore_delete( Semaphore_id[ 2 ] ); + fatal_directive_status( + status, + RTEMS_RESOURCE_IN_USE, + "rtems_semaphore_delete of SM2" + ); + + puts( "TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL" ); + status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + directive_failed( status, "rtems_task_wake_after (yield)" ); + + status = rtems_task_delete( Task_id[ 2 ] ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_task_delete after the task has been deleted" + ); +} diff --git a/c/src/tests/sptests/sp09/screen07.c b/c/src/tests/sptests/sp09/screen07.c new file mode 100644 index 0000000000..fd808f833d --- /dev/null +++ b/c/src/tests/sptests/sp09/screen07.c @@ -0,0 +1,184 @@ +/* Screen7 + * + * This routine generates error screen 7 for test 9. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Screen7() +{ + long buffer[ 4 ]; + rtems_unsigned32 count; + rtems_status_code status; + + status = rtems_message_queue_broadcast( 100, (long (*)[4]) buffer, &count ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_message_queue_broadcast with illegal id" + ); + puts( "TA1 - rtems_message_queue_broadcast - RTEMS_INVALID_ID" ); + + status = rtems_message_queue_create( + 0, + 3, + RTEMS_DEFAULT_ATTRIBUTES, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_message_queue_create with illegal name" + ); + + puts( "TA1 - rtems_message_queue_create - Q 1 - RTEMS_INVALID_NAME" ); + status = rtems_message_queue_create( + Queue_name[ 1 ], + 1, + RTEMS_GLOBAL, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_MP_NOT_CONFIGURED, + "rtems_message_queue_create of mp not configured" + ); + puts( "TA1 - rtems_message_queue_create - Q 1 - RTEMS_MP_NOT_CONFIGURED" ); + + status = rtems_message_queue_create( + Queue_name[ 1 ], + 2, + RTEMS_LIMIT, + &Queue_id[ 1 ] + ); + directive_failed( status, "rtems_message_queue_create successful" ); + puts( + "TA1 - rtems_message_queue_create - Q 1 - RTEMS_LIMIT - RTEMS_SUCCESSFUL" + ); + + status = rtems_message_queue_create( + Queue_name[ 2 ], + 1, + RTEMS_DEFAULT_ATTRIBUTES, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_TOO_MANY, + "rtems_message_queue_create of too many" + ); + puts( "TA1 - rtems_message_queue_create - Q 2 - RTEMS_TOO_MANY" ); + + status = rtems_message_queue_delete( 100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_message_queue_create with illegal id" + ); + puts( "TA1 - rtems_message_queue_delete - unknown RTEMS_INVALID_ID" ); + + status = rtems_message_queue_delete( 0x10100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_message_queue_delete with local illegal id" + ); + puts( "TA1 - rtems_message_queue_delete - local RTEMS_INVALID_ID" ); + + status = rtems_message_queue_ident( 100, RTEMS_SEARCH_ALL_NODES, &Junk_id ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_message_queue_ident with illegal name" + ); + puts( "TA1 - rtems_message_queue_ident - RTEMS_INVALID_NAME" ); + + status = rtems_message_queue_flush( 100, &count ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_message_queue_flush with illegal id" + ); + puts( "TA1 - rtems_message_queue_flush - RTEMS_INVALID_ID" ); + + status = rtems_message_queue_receive( + 100, + (long (*)[4]) buffer, + RTEMS_DEFAULT_OPTIONS, + 0 + ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_message_queue_receive wit illegal id" + ); + puts( "TA1 - rtems_message_queue_receive - RTEMS_INVALID_ID" ); + + status = rtems_message_queue_receive( + Queue_id[ 1 ], + (long (*)[4]) buffer, + RTEMS_NO_WAIT, + RTEMS_NO_TIMEOUT + ); + fatal_directive_status( + status, + RTEMS_UNSATISFIED, + "rtems_message_queue_receive unsatisfied" + ); + puts( "TA1 - rtems_message_queue_receive - Q 1 - RTEMS_UNSATISFIED" ); + + puts( "TA1 - rtems_message_queue_receive - Q 1 - timeout in 3 seconds" ); + status = rtems_message_queue_receive( + Queue_id[ 1 ], + (long (*)[4]) buffer, + RTEMS_DEFAULT_OPTIONS, + 3 * TICKS_PER_SECOND + ); + fatal_directive_status( + status, + RTEMS_TIMEOUT, + "rtems_message_queue_receive 3 second timeout" + ); + + puts( + "TA1 - rtems_message_queue_receive - Q 1 - woke up with RTEMS_TIMEOUT" + ); + + status = rtems_message_queue_send( 100, (long (*)[4]) buffer ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_message_queue_send with illegal id" + ); + puts( "TA1 - rtems_message_queue_send - RTEMS_INVALID_ID" ); + + status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4]) buffer ); + directive_failed( status, "rtems_message_queue_send" ); + puts( "TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1 - RTEMS_SUCCESSFUL" ); + + status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4]) buffer ); + directive_failed( status, "rtems_message_queue_send" ); + puts( "TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1 - RTEMS_SUCCESSFUL" ); + + status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4]) buffer ); + fatal_directive_status( + status, + RTEMS_TOO_MANY, + "rtems_message_queue_send too many to a limited queue" + ); + puts( "TA1 - rtems_message_queue_send - BUFFER 3 TO Q 1 - RTEMS_TOO_MANY" ); +} diff --git a/c/src/tests/sptests/sp09/screen08.c b/c/src/tests/sptests/sp09/screen08.c new file mode 100644 index 0000000000..18c9b8d2d8 --- /dev/null +++ b/c/src/tests/sptests/sp09/screen08.c @@ -0,0 +1,121 @@ +/* Screen8 + * + * This routine generates error screen 8 for test 9. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Screen8() +{ + long buffer[ 4 ]; + rtems_status_code status; + + status = rtems_message_queue_delete( Queue_id[ 1 ] ); + directive_failed( status, "rtems_message_queue_delete successful" ); + puts( "TA1 - rtems_message_queue_delete - Q 1 - RTEMS_SUCCESSFUL" ); + + status = rtems_message_queue_create( + Queue_name[ 1 ], + 2, + RTEMS_LIMIT, + &Queue_id[ 1 ] + ); + directive_failed( status, "rtems_message_queue_create successful" ); + puts( + "TA1 - rtems_message_queue_create - Q 1 - RTEMS_LIMIT - RTEMS_SUCCESSFUL" + ); + + status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer ); + directive_failed( status, "rtems_message_queue_send successful" ); + puts( "TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1 - RTEMS_SUCCESSFUL" ); + + status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer ); + directive_failed( status, "rtems_message_queue_send successful" ); + puts( "TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1 - RTEMS_SUCCESSFUL" ); + + status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer ); + fatal_directive_status( + status, + RTEMS_TOO_MANY, + "rtems_message_queue_send too many to limited queue" + ); + puts( "TA1 - rtems_message_queue_send - BUFFER 3 TO Q 1 - RTEMS_TOO_MANY" ); + + status = rtems_message_queue_delete( Queue_id[ 1 ] ); + directive_failed( status, "rtems_message_queue_delete successful" ); + puts( "TA1 - rtems_message_queue_delete - Q 1 - RTEMS_SUCCESSFUL" ); + + status = rtems_message_queue_create( + Queue_name[ 1 ], + 3, + RTEMS_LIMIT, + &Queue_id[ 1 ] + ); + directive_failed( status, "rtems_message_queue_create successful" ); + puts( + "TA1 - rtems_message_queue_create - Q 1 - RTEMS_LIMIT - RTEMS_SUCCESSFUL" + ); + + status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer ); + directive_failed( status, "rtems_message_queue_send successful" ); + puts( "TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1 - RTEMS_SUCCESSFUL" ); + + status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer ); + directive_failed( status, "rtems_message_queue_send successful" ); + puts( "TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1 - RTEMS_SUCCESSFUL" ); + + status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer ); + fatal_directive_status( + status, + RTEMS_UNSATISFIED, + "rtems_message_queue_send too many to limited queue" + ); + puts( + "TA1 - rtems_message_queue_send - BUFFER 3 TO Q 1 - RTEMS_UNSATISFIED" + ); + + status = rtems_message_queue_delete( Queue_id[ 1 ] ); + directive_failed( status, "rtems_message_queue_delete successful" ); + puts( "TA1 - rtems_message_queue_delete - Q 1 - RTEMS_SUCCESSFUL" ); + + status = rtems_message_queue_create( + Queue_name[ 1 ], + 3, + RTEMS_LIMIT, + &Queue_id[ 1 ] + ); + directive_failed( status, "rtems_message_queue_create successful" ); + puts( + "TA1 - rtems_message_queue_create - Q 1 - RTEMS_LIMIT - RTEMS_SUCCESSFUL" + ); + + puts( "TA1 - rtems_task_start - start TA3 - RTEMS_SUCCESSFUL" ); + status = rtems_task_start( Task_id[ 3 ], Task_3, 0 ); + directive_failed( status, "rtems_task_start of TA3" ); + + puts( "TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL" ); + status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + directive_failed( status, "rtems_task_wake_after (yield)" ); + + puts( "TA1 - rtems_message_queue_delete - delete Q 1 - RTEMS_SUCCESSFUL" ); + status = rtems_message_queue_delete( Queue_id[ 1 ] ); + directive_failed( status, "rtems_message_queue_delete successful" ); + + puts( "TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL" ); + status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + directive_failed( status, "rtems_task_wake_after (yield)" ); +} diff --git a/c/src/tests/sptests/sp09/screen09.c b/c/src/tests/sptests/sp09/screen09.c new file mode 100644 index 0000000000..5c6eece679 --- /dev/null +++ b/c/src/tests/sptests/sp09/screen09.c @@ -0,0 +1,140 @@ +/* Screen9 + * + * This routine generates error screen 9 for test 9. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Screen9() +{ + void *converted; + rtems_status_code status; + rtems_isr_entry old_service_routine; + + status = rtems_interrupt_catch( Service_routine, 500, &old_service_routine ); + fatal_directive_status( + status, + RTEMS_INVALID_NUMBER, + "rtems_interrupt_catch with invalid vector" + ); + puts( "TA1 - rtems_interrupt_catch - RTEMS_INVALID_NUMBER" ); + + status = rtems_interrupt_catch( NULL, 3, &old_service_routine ); + fatal_directive_status( + status, + RTEMS_INVALID_ADDRESS, + "rtems_interrupt_catch with invalid handler" + ); + puts( "TA1 - rtems_interrupt_catch - RTEMS_INVALID_ADDRESS" ); + + status = rtems_signal_send( 100, RTEMS_SIGNAL_1 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_signal_send with illegal id" + ); + puts( "TA1 - rtems_signal_send - RTEMS_INVALID_ID" ); + + status = rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_16 ); + fatal_directive_status( + status, + RTEMS_NOT_DEFINED, + "rtems_signal_send with no handler" + ); + puts( "TA1 - rtems_signal_send - RTEMS_NOT_DEFINED" ); + + status = rtems_port_create( + 0, + Internal_port_area, + External_port_area, + sizeof( Internal_port_area ), + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_port_create with illegal name" + ); + puts( "TA1 - rtems_port_create - RTEMS_INVALID_NAME" ); + + status = rtems_port_create( + Port_name[ 1 ], + &((char *)Internal_port_area)[ 1 ], + External_port_area, + sizeof( Internal_port_area ), + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_INVALID_ADDRESS, + "rtems_port_create with illegal address" + ); + puts( "TA1 - rtems_port_create - RTEMS_INVALID_ADDRESS" ); + + status = rtems_port_create( + Port_name[ 1 ], + Internal_port_area, + External_port_area, + sizeof( Internal_port_area ), + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_TOO_MANY, + "rtems_port_create of too many" + ); + puts( "TA1 - rtems_port_create - RTEMS_TOO_MANY" ); + + status = rtems_port_delete( 0 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_port_delete with illegal id" + ); + puts( "TA1 - rtems_port_delete - RTEMS_INVALID_ID" ); + + status = rtems_port_ident( 0, &Junk_id ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_port_ident with illegal name" + ); + puts( "TA1 - rtems_port_ident - RTEMS_INVALID_NAME" ); + + status = rtems_port_external_to_internal( + 100, + Internal_port_area, + &converted + ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_port_external_to_internal with illegal id" + ); + puts( "TA1 - rtems_port_external_to_internal - RTEMS_INVALID_ID" ); + status = rtems_port_internal_to_external( + 100, + Internal_port_area, + &converted + ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_port_internal_to_external with illegal id" + ); + puts( "TA1 - rtems_port_internal_to_external - RTEMS_INVALID_ID" ); +} diff --git a/c/src/tests/sptests/sp09/screen10.c b/c/src/tests/sptests/sp09/screen10.c new file mode 100644 index 0000000000..53a5a8d6dc --- /dev/null +++ b/c/src/tests/sptests/sp09/screen10.c @@ -0,0 +1,164 @@ +/* Screen10 + * + * This routine generates error screen 10 for test 9. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Screen10() +{ + rtems_status_code status; + + status = rtems_rate_monotonic_create( 0, &Junk_id ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_rate_monotonic_create with illegal name" + ); + puts( "TA1 - rtems_rate_monotonic_create - RTEMS_INVALID_NAME" ); + + status = rtems_rate_monotonic_create( Period_name[ 1 ], &Period_id[ 1 ] ); + directive_failed( status, "rtems_rate_monotonic_create successful" ); + puts( "TA1 - rtems_rate_monotonic_create - RTEMS_SUCCESSFUL" ); + + status = rtems_rate_monotonic_create( Period_name[ 1 ], &Junk_id ); + fatal_directive_status( + status, + RTEMS_TOO_MANY, + "rtems_rate_monotonic_create of too many" + ); + puts( "TA1 - rtems_rate_monotonic_create - RTEMS_TOO_MANY" ); + + status = rtems_rate_monotonic_ident( 0, &Junk_id ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_rate_monotonic_ident with illegal name" + ); + puts( "TA1 - rtems_rate_monotonic_ident - RTEMS_INVALID_NAME" ); + + status = rtems_rate_monotonic_period( 100, 5 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_rate_monotonic_period with illegal id" + ); + puts( "TA1 - rtems_rate_monotonic_period - unknown RTEMS_INVALID_ID" ); + + status = rtems_rate_monotonic_period( 0x10100, 5 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_rate_monotonic_period with illegal id" + ); + puts( "TA1 - rtems_rate_monotonic_period - local RTEMS_INVALID_ID" ); + + status = rtems_rate_monotonic_period( Period_id[ 1 ], RTEMS_PERIOD_STATUS ); + fatal_directive_status( + status, + RTEMS_NOT_DEFINED, + "rtems_rate_monotonic_period status not defined" + ); + puts( + "TA1 - rtems_rate_monotonic_period(RTEMS_PERIOD_STATUS) - RTEMS_NOT_DEFINED" + ); + + status = rtems_rate_monotonic_period( Period_id[ 1 ], 100 ); + directive_failed( status, "rtems_rate_monotonic_period successful" ); + puts( "TA1 - rtems_rate_monotonic_period - 100 ticks - RTEMS_SUCCESSFUL" ); + + status = rtems_rate_monotonic_period( Period_id[ 1 ], RTEMS_PERIOD_STATUS ); + directive_failed( status, "rtems_rate_monotonic_period status" ); + puts( + "TA1 - rtems_rate_monotonic_period(RTEMS_PERIOD_STATUS) - RTEMS_SUCCESSFUL" + ); + + while ( FOREVER ) { + + status = rtems_rate_monotonic_period(Period_id[ 1 ], RTEMS_PERIOD_STATUS); + + if ( status == RTEMS_TIMEOUT ) break; + + directive_failed( + status, + "rtems_rate_monotonic_period waiting for timeout" + ); + } + puts( + "TA1 - rtems_rate_monotonic_period(RTEMS_PERIOD_STATUS) - RTEMS_TIMEOUT" + ); + + status = rtems_rate_monotonic_cancel( 100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_rate_monotonic_cancel with illegal id" + ); + puts( "TA1 - rtems_rate_monotonic_cancel - unknown RTEMS_INVALID_ID" ); + + status = rtems_rate_monotonic_cancel( 0x10100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_rate_monotonic_cancel will illegal id" + ); + puts( "TA1 - rtems_rate_monotonic_cancel - local RTEMS_INVALID_ID" ); + + status = rtems_rate_monotonic_cancel( Period_id[ 1 ] ); + directive_failed( status, "rtems_rate_monotonic_cancel" ); + puts( "TA1 - rtems_rate_monotonic_cancel - RTEMS_SUCCESSFUL" ); + + status = rtems_rate_monotonic_period( Period_id[ 1 ], 5 ); + directive_failed( status, "rtems_rate_monotonic_period restart" ); + + status = rtems_task_wake_after( 1 * TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + status = rtems_rate_monotonic_period( Period_id[ 1 ], 5 ); + fatal_directive_status( + status, + RTEMS_TIMEOUT, + "rtems_rate_monotonic_period" + ); + puts( "TA1 - rtems_rate_monotonic_period - 5 ticks - RTEMS_TIMEOUT" ); + + status = rtems_task_start( Task_id[ 4 ], Task_4, 0 ); + directive_failed( status, "rtems_task_start of TA4" ); + + puts( "TA1 - yielding to TA4" ); + status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + + status = rtems_rate_monotonic_delete( 100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_rate_monotonic_delete with illegal id" + ); + puts( "TA1 - rtems_rate_monotonic_delete - unknown RTEMS_INVALID_ID" ); + + status = rtems_rate_monotonic_delete( 0x10100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_rate_monotonic_delete with illegal id" + ); + puts( "TA1 - rtems_rate_monotonic_delete - local RTEMS_INVALID_ID" ); + + status = rtems_rate_monotonic_delete( Period_id[ 1 ] ); + directive_failed( status, "rtems_rate_monotonic_delete" ); + puts( "TA1 - rtems_rate_monotonic_delete - RTEMS_SUCCESSFUL" ); +} diff --git a/c/src/tests/sptests/sp09/screen11.c b/c/src/tests/sptests/sp09/screen11.c new file mode 100644 index 0000000000..8c13cd2490 --- /dev/null +++ b/c/src/tests/sptests/sp09/screen11.c @@ -0,0 +1,250 @@ +/* Screen11 + * + * This routine generates error screen 11 for test 9. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Screen11() +{ + void *buffer_address_1; + void *buffer_address_2; + void *buffer_address_3; + rtems_status_code status; + + status = rtems_partition_create( + 0, + Partition_good_area, + 128, + 40, + RTEMS_DEFAULT_ATTRIBUTES, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_partition_create with illegal name" + ); + puts( "TA1 - rtems_partition_create - RTEMS_INVALID_NAME" ); + + status = rtems_partition_create( + Partition_name[ 1 ], + Partition_good_area, + 0, + 80, + RTEMS_DEFAULT_ATTRIBUTES, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_INVALID_SIZE, + "rtems_partition_create with illegal length" + ); + puts( "TA1 - rtems_partition_create - length - RTEMS_INVALID_SIZE" ); + + status = rtems_partition_create( + Partition_name[ 1 ], + Partition_good_area, + 128, + 0, + RTEMS_DEFAULT_ATTRIBUTES, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_INVALID_SIZE, + "rtems_partition_create with illegal buffer size" + ); + puts( "TA1 - rtems_partition_create - buffer size - RTEMS_INVALID_SIZE" ); + + status = rtems_partition_create( + Partition_name[ 1 ], + Partition_good_area, + 128, + 256, + RTEMS_DEFAULT_ATTRIBUTES, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_INVALID_SIZE, + "rtems_partition_create with buffer_size > length" + ); + puts( + "TA1 - rtems_partition_create - length < buffer size - RTEMS_INVALID_SIZE" + ); + + status = rtems_partition_create( + Partition_name[ 1 ], + Partition_good_area, + 128, + 64, + RTEMS_GLOBAL, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_MP_NOT_CONFIGURED, + "rtems_partition_create of global" + ); + puts( "TA1 - rtems_partition_create - RTEMS_MP_NOT_CONFIGURED" ); + + status = rtems_partition_create( + Partition_name[ 1 ], + Partition_bad_area, + 128, + 64, + RTEMS_GLOBAL, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_INVALID_ADDRESS, + "rtems_partition_create with bad address" + ); + puts( "TA1 - rtems_partition_create - RTEMS_INVALID_ADDRESS" ); + + status = rtems_partition_create( + Partition_name[ 1 ], + Partition_good_area, + 128, + 34, + RTEMS_DEFAULT_ATTRIBUTES, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_INVALID_SIZE, + "rtems_partition_create with unaligned buffer_size" + ); + puts( "TA1 - rtems_partition_create - RTEMS_INVALID_SIZE" ); + + status = rtems_partition_delete( 100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_partition_delete with illegal id" + ); + puts( "TA1 - rtems_partition_delete - unknown RTEMS_INVALID_ID" ); + + status = rtems_partition_delete( 0x10100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_partition_delete with illegal id" + ); + puts( "TA1 - rtems_partition_delete - local RTEMS_INVALID_ID" ); + + status = rtems_partition_get_buffer( 100, &buffer_address_1 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_partition_get_buffer with illegal id" + ); + puts( "TA1 - rtems_partition_get_buffer - RTEMS_INVALID_ID" ); + + status = rtems_partition_ident( 0, RTEMS_SEARCH_ALL_NODES, &Junk_id ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_partition_ident with illegal name" + ); + puts( "TA1 - rtems_partition_ident - RTEMS_INVALID_NAME" ); + + status = rtems_partition_return_buffer( 100, buffer_address_1 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_partition_return_buffer with illegal id" + ); + puts( "TA1 - rtems_partition_return_buffer - RTEMS_INVALID_ID" ); + + status = rtems_partition_create( + Partition_name[ 1 ], + Partition_good_area, + 128, + 64, + RTEMS_DEFAULT_ATTRIBUTES, + &Partition_id[ 1 ] + ); + directive_failed( status, "rtems_partition_create" ); + puts( "TA1 - rtems_partition_create - RTEMS_SUCCESSFUL" ); + + status = rtems_partition_create( + Partition_name[ 1 ], + Partition_good_area, + 128, + 32, + RTEMS_DEFAULT_ATTRIBUTES, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_TOO_MANY, + "rtems_partition_create of too many" + ); + puts( "TA1 - rtems_partition_create - RTEMS_TOO_MANY" ); + + status = rtems_partition_get_buffer( Partition_id[ 1 ], &buffer_address_1 ); + directive_failed( status, "rtems_partition_get_buffer"); + puts( "TA1 - rtems_partition_get_buffer - RTEMS_SUCCESSFUL" ); + + status = rtems_partition_get_buffer( Partition_id[ 1 ], &buffer_address_2 ); + directive_failed( status, "rtems_partition_get_buffer" ); + puts( "TA1 - rtems_partition_get_buffer - RTEMS_SUCCESSFUL" ); + + status = rtems_partition_get_buffer( Partition_id[ 1 ], &buffer_address_3 ); + fatal_directive_status( + status, + RTEMS_UNSATISFIED, + "rtems_partition_get_buffer unsatisfied" + ); + puts( "TA1 - rtems_partition_get_buffer - RTEMS_UNSATISFIED" ); + + status = rtems_partition_delete( Partition_id[ 1 ] ); + fatal_directive_status( + status, + RTEMS_RESOURCE_IN_USE, + "rtems_partition_delete with buffers in use" + ); + puts( "TA1 - rtems_partition_delete - RTEMS_RESOURCE_IN_USE" ); + + status = rtems_partition_return_buffer( + Partition_id[ 1 ], + Region_good_area /* NOTE: Region Memory */ + ); + fatal_directive_status( + status, + RTEMS_INVALID_ADDRESS, + "rtems_partition_return_buffer with buffer address out of partition" + ); + puts( + "TA1 - rtems_partition_return_buffer - RTEMS_INVALID_ADDRESS - out of range" + ); + + status = rtems_partition_return_buffer( + Partition_id[ 1 ], + &Partition_good_area[ 7 ] + ); + fatal_directive_status( + status, + RTEMS_INVALID_ADDRESS, + "rtems_partition_return_buffer with buffer address not on boundary" + ); + puts_nocr( "TA1 - rtems_partition_return_buffer - " ); + puts ( "RTEMS_INVALID_ADDRESS - not on boundary"); +} diff --git a/c/src/tests/sptests/sp09/screen12.c b/c/src/tests/sptests/sp09/screen12.c new file mode 100644 index 0000000000..300d54043a --- /dev/null +++ b/c/src/tests/sptests/sp09/screen12.c @@ -0,0 +1,327 @@ +/* Screen12 + * + * This routine generates error screen 12 for test 9. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Screen12() +{ + void *segment_address_1; + void *segment_address_2; + void *segment_address_3; + rtems_unsigned32 offset; + rtems_unsigned32 good_front_flag; + rtems_unsigned32 good_back_flag; + rtems_status_code status; + + status = rtems_region_create( + 0, + Region_good_area, + 128, + 32, + RTEMS_DEFAULT_ATTRIBUTES, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_region_create with illegal name" + ); + puts( "TA1 - rtems_region_create - RTEMS_INVALID_NAME" ); + + status = rtems_region_create( + Region_name[ 1 ], + Region_bad_area, + 128, + 32, + RTEMS_DEFAULT_ATTRIBUTES, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_INVALID_ADDRESS, + "rtems_region_create with illegal address" + ); + puts( "TA1 - rtems_region_create - RTEMS_INVALID_ADDRESS" ); + + status = rtems_region_create( + Region_name[ 1 ], + Region_good_area, + 128, + 34, + RTEMS_DEFAULT_ATTRIBUTES, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_INVALID_SIZE, + "rtems_region_create with illegal size" + ); + puts( "TA1 - rtems_region_create - RTEMS_INVALID_SIZE" ); + + status = rtems_region_create( + Region_name[ 1 ], + &Region_good_area[ REGION_START_OFFSET ], + REGION_LENGTH, + 128, + RTEMS_DEFAULT_ATTRIBUTES, + &Region_id[ 1 ] + ); + directive_failed( status, "rtems_region_create" ); + puts( "TA1 - rtems_region_create - RTEMS_SUCCESSFUL" ); + + status = rtems_region_create( + Region_name[ 1 ], + Region_good_area, + 512, + 128, + RTEMS_DEFAULT_ATTRIBUTES, + &Junk_id + ); + fatal_directive_status( + status, + RTEMS_TOO_MANY, + "rtems_region_create of too many" + ); + puts( "TA1 - rtems_region_create - RTEMS_TOO_MANY" ); + + status = rtems_region_delete( 100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_region_delete with illegal id" + ); + puts( "TA1 - rtems_region_delete - unknown RTEMS_INVALID_ID" ); + + status = rtems_region_delete( 0x10100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_region_delete with illegal id" + ); + puts( "TA1 - rtems_region_delete - local RTEMS_INVALID_ID" ); + + status = rtems_region_ident( 0, &Junk_id ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_region_ident with illegal name" + ); + puts( "TA1 - rtems_region_ident - RTEMS_INVALID_NAME" ); + + status = rtems_region_get_segment( + 100, + 128, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &segment_address_1 + ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_region_get_segment with illegal id" + ); + puts( "TA1 - rtems_region_get_segment - RTEMS_INVALID_ID" ); + + status = rtems_region_get_segment( + Region_id[ 1 ], + sizeof( Region_good_area ) * 2, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &segment_address_1 + ); + fatal_directive_status( + status, + RTEMS_INVALID_SIZE, + "rtems_region_get_segment with illegal size" + ); + puts( "TA1 - rtems_region_get_segment - RTEMS_INVALID_SIZE" ); + + status = rtems_region_get_segment( + Region_id[ 1 ], + 384, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &segment_address_1 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts( "TA1 - rtems_region_get_segment - RTEMS_SUCCESSFUL" ); + + status = rtems_region_get_segment( + Region_id[ 1 ], + 384, + RTEMS_NO_WAIT, + RTEMS_NO_TIMEOUT, + &segment_address_2 + ); + fatal_directive_status( + status, + RTEMS_UNSATISFIED, + "rtems_region_get_segment unsatisfied" + ); + puts( "TA1 - rtems_region_get_segment - RTEMS_UNSATISFIED" ); + + puts( "TA1 - rtems_region_get_segment - timeout in 3 seconds" ); + status = rtems_region_get_segment( + Region_id[ 1 ], + 128, + RTEMS_DEFAULT_OPTIONS, + 3 * TICKS_PER_SECOND, + &segment_address_3 + ); + fatal_directive_status( + status, + RTEMS_TIMEOUT, + "rtems_region_get_segment timeout" + ); + puts( "TA1 - rtems_region_get_segment - woke up with RTEMS_TIMEOUT" ); + + status = rtems_region_delete( Region_id[ 1 ] ); + fatal_directive_status( + status, + RTEMS_RESOURCE_IN_USE, + "rtems_region_delete with buffers in use" + ); + puts( "TA1 - rtems_region_delete - RTEMS_RESOURCE_IN_USE" ); + + status = rtems_region_return_segment( 100, segment_address_1 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_region_return_segment with illegal id" + ); + puts( "TA1 - rtems_region_return_segment - RTEMS_INVALID_ID" ); + + status = rtems_region_return_segment( Region_id[ 1 ], Region_good_area ); + fatal_directive_status( + status, + RTEMS_INVALID_ADDRESS, + "rtems_region_return_segment with illegal segment" + ); + puts( "TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS" ); + +/* + * The following generate internal heap errors. Thus this code + * is subject to change if the heap code changes. + */ + + puts( "TA1 - rtems_debug_disable - RTEMS_DEBUG_REGION" ); + rtems_debug_disable( RTEMS_DEBUG_REGION ); + + offset = (segment_address_1 - (void *)Region_good_area) / 4; + +/* bad FRONT_FLAG error */ + + good_front_flag = Region_good_area[ offset - 1 ]; + Region_good_area[ offset - 1 ] = good_front_flag + 2; + + status = rtems_region_return_segment( Region_id[ 1 ], segment_address_1 ); + fatal_directive_status( + status, + RTEMS_INVALID_ADDRESS, + "rtems_region_return_segment with back_flag != front_flag" + ); + puts( "TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS" ); + + Region_good_area[ offset - 1 ] = good_front_flag; + +/* bad FRONT_FLAG error */ + + good_back_flag = Region_good_area[ offset - 2 ]; + Region_good_area[ offset - 2 ] = 1024; + + status = rtems_region_return_segment( Region_id[ 1 ], segment_address_1 ); + fatal_directive_status( + status, + RTEMS_INVALID_ADDRESS, + "rtems_region_return_segment with back_flag != front_flag" + ); + puts( "TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS" ); + + Region_good_area[ offset - 2 ] = good_back_flag; + + puts( "TA1 - rtems_debug_enable - RTEMS_DEBUG_REGION" ); + rtems_debug_enable( RTEMS_DEBUG_REGION ); + + status = rtems_region_extend( + 100, + Region_good_area, + 128 + ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_region_extend with illegal id" + ); + puts( "TA1 - rtems_region_extend - RTEMS_INVALID_ID" ); + + status = rtems_region_extend( + Region_id[ 1 ], + &Region_good_area[ REGION_START_OFFSET + 16 ], + 128 + ); + fatal_directive_status( + status, + RTEMS_INVALID_ADDRESS, + "rtems_region_extend with illegal starting address" + ); + puts( "TA1 - rtems_region_extend - within heap - RTEMS_INVALID_ADDRESS" ); + + status = rtems_region_extend( + Region_id[ 1 ], + Region_bad_area, + 128 + ); + fatal_directive_status( + status, + RTEMS_NOT_IMPLEMENTED, + "rtems_region_extend with unsupported starting address" + ); + puts( + "TA1 - rtems_region_extend - non-contiguous lower - RTEMS_NOT_IMPLEMENTED" + ); + + status = rtems_region_extend( + Region_id[ 1 ], + &Region_good_area[ REGION_START_OFFSET - REGION_LENGTH ], + 128 + ); + fatal_directive_status( + status, + RTEMS_NOT_IMPLEMENTED, + "rtems_region_extend with unsupported starting address" + ); + puts( + "TA1 - rtems_region_extend - contiguous lower - RTEMS_NOT_IMPLEMENTED" + ); + + status = rtems_region_extend( + Region_id[ 1 ], + &Region_good_area[ REGION_START_OFFSET + REGION_LENGTH + 16 ], + 128 + ); + fatal_directive_status( + status, + RTEMS_NOT_IMPLEMENTED, + "rtems_region_extend with unsupported starting address" + ); + puts( + "TA1 - rtems_region_extend - non-contiguous higher - RTEMS_NOT_IMPLEMENTED" + ); + +} diff --git a/c/src/tests/sptests/sp09/screen13.c b/c/src/tests/sptests/sp09/screen13.c new file mode 100644 index 0000000000..c96adeec40 --- /dev/null +++ b/c/src/tests/sptests/sp09/screen13.c @@ -0,0 +1,115 @@ +/* Screen13 + * + * This routine generates error screen 13 for test 9. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Screen13() +{ + rtems_unsigned32 result; + rtems_time_of_day time; + rtems_status_code status; + + status = rtems_io_close( 0xffff, 0x0000, NULL, &result ); + fatal_directive_status( + status, + RTEMS_INVALID_NUMBER, + "rtems_io_close with bad major number" + ); + puts( "TA1 - rtems_io_close - RTEMS_INVALID_NUMBER" ); + status = rtems_io_control( 0xffff, 0x00000, NULL, &result ); + fatal_directive_status( + status, + RTEMS_INVALID_NUMBER, + "rtems_io_close with bad major number" + ); + puts( "TA1 - rtems_io_control - RTEMS_INVALID_NUMBER" ); + status = rtems_io_initialize( 0xffff, 0x00000, NULL, &result ); + fatal_directive_status( + status, + RTEMS_INVALID_NUMBER, + "rtems_io_initialize with bad major number" + ); + puts( "TA1 - rtems_io_initialize - RTEMS_INVALID_NUMBER" ); + status = rtems_io_open( 0xffff, 0x00000, NULL, &result ); + fatal_directive_status( + status, + RTEMS_INVALID_NUMBER, + "rtems_io_open with bad major number" + ); + puts( "TA1 - rtems_io_open - RTEMS_INVALID_NUMBER" ); + status = rtems_io_read( 0xffff, 0x00000, NULL, &result ); + fatal_directive_status( + status, + RTEMS_INVALID_NUMBER, + "rtems_io_read with bad major number" + ); + puts( "TA1 - rtems_io_read - RTEMS_INVALID_NUMBER" ); + status = rtems_io_write( 0xffff, 0x0ffff, NULL, &result ); + fatal_directive_status( + status, + RTEMS_INVALID_NUMBER, + "rtems_io_write with bad major number" + ); + puts( "TA1 - rtems_io_write - RTEMS_INVALID_NUMBER" ); + + build_time( &time, 12, 31, 2000, 23, 59, 59, 0 ); + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" ); + status = rtems_task_wake_after( 1 * TICKS_PER_SECOND ); + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_set" ); + print_time( "TA1 - rtems_clock_get - ", &time, " - RTEMS_SUCCESSFUL\n" ); + + build_time( &time, 12, 31, 1999, 23, 59, 59, 0 ); + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" ); + status = rtems_task_wake_after( 1 * TICKS_PER_SECOND ); + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_set" ); + print_time( "TA1 - rtems_clock_get - ", &time, " - RTEMS_SUCCESSFUL\n" ); + + build_time( &time, 12, 31, 2100, 23, 59, 59, 0 ); + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" ); + status = rtems_task_wake_after( 1 * TICKS_PER_SECOND ); + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_set" ); + print_time( "TA1 - rtems_clock_get - ", &time, " - RTEMS_SUCCESSFUL\n" ); + + build_time( &time, 12, 31, 2099, 23, 59, 59, 0 ); + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" ); + status = rtems_task_wake_after( 1 * TICKS_PER_SECOND ); + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_set" ); + print_time( "TA1 - rtems_clock_get - ", &time, " - RTEMS_SUCCESSFUL\n" ); + + build_time( &time, 12, 31, 1991, 23, 59, 59, 0 ); + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + print_time( "TA1 - rtems_clock_set - ", &time, " - RTEMS_SUCCESSFUL\n" ); + status = rtems_task_wake_after( 1 * TICKS_PER_SECOND ); + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_set" ); + print_time( "TA1 - rtems_clock_get - ", &time, " - RTEMS_SUCCESSFUL\n" ); +} diff --git a/c/src/tests/sptests/sp09/screen14.c b/c/src/tests/sptests/sp09/screen14.c new file mode 100644 index 0000000000..bf80f04c3c --- /dev/null +++ b/c/src/tests/sptests/sp09/screen14.c @@ -0,0 +1,162 @@ +/* Screen14 + * + * This routine generates error screen 14 for test 9. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Screen14() +{ + rtems_status_code status; + rtems_time_of_day time; + + status = rtems_timer_create( 0, &Junk_id ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_timer_create with illegal name" + ); + puts( "TA1 - rtems_timer_create - RTEMS_INVALID_NAME" ); + + status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] ); + directive_failed( status, "rtems_timer_create" ); + puts( "TA1 - rtems_timer_create - 1 - RTEMS_SUCCESSFUL" ); + + status = rtems_timer_create( 2, &Junk_id ); + fatal_directive_status( + status, + RTEMS_TOO_MANY, + "rtems_timer_create for too many" + ); + puts( "TA1 - rtems_timer_create - 2 - RTEMS_TOO_MANY" ); + + status = rtems_timer_delete( 100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_timer_delete with illegal id" + ); + puts( "TA1 - rtems_timer_delete - local RTEMS_INVALID_ID" ); + + status = rtems_timer_delete( 0x010100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_timer_delete with illegal id" + ); + puts( "TA1 - rtems_timer_delete - global RTEMS_INVALID_ID" ); + + status = rtems_timer_ident( 0, &Junk_id ); + fatal_directive_status( + status, + RTEMS_INVALID_NAME, + "rtems_timer_ident with illegal name" + ); + puts( "TA1 - rtems_timer_ident - RTEMS_INVALID_NAME" ); + + status = rtems_timer_cancel( 0x010100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_timer_cancel with illegal id" + ); + puts( "TA1 - rtems_timer_cancel - RTEMS_INVALID_ID" ); + + status = rtems_timer_cancel( Timer_id[ 1 ] ); + fatal_directive_status( + status, + RTEMS_INCORRECT_STATE, + "rtems_timer_cancel before initiated" + ); + puts( "TA1 - rtems_timer_cancel - RTEMS_INCORRECT_STATE" ); + + status = rtems_timer_reset( 0x010100 ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_timer_reset with illegal id" + ); + puts( "TA1 - rtems_timer_reset - RTEMS_INVALID_ID" ); + + status = rtems_timer_reset( Timer_id[ 1 ] ); + fatal_directive_status( + status, + RTEMS_NOT_DEFINED, + "rtems_timer_reset before initiated" + ); + puts( "TA1 - rtems_timer_reset - RTEMS_NOT_DEFINED" ); + + status = rtems_timer_fire_after( + 0x010100, + 5 * TICKS_PER_SECOND, + Delayed_routine, + NULL + ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_timer_fire_after illegal id" + ); + puts( "TA1 - rtems_timer_fire_after - RTEMS_INVALID_ID" ); + + build_time( &time, 12, 31, 1994, 9, 0, 0, 0 ); + status = rtems_timer_fire_when( 0x010100, &time, Delayed_routine, NULL ); + fatal_directive_status( + status, + RTEMS_INVALID_ID, + "rtems_timer_fire_when with illegal id" + ); + puts( "TA1 - rtems_timer_fire_when - RTEMS_INVALID_ID" ); + + status = rtems_timer_fire_after( Timer_id[ 1 ], 0, Delayed_routine, NULL ); + fatal_directive_status( + status, + RTEMS_INVALID_NUMBER, + "rtems_timer_fire_after with 0 ticks" + ); + puts( "TA1 - rtems_timer_fire_after - RTEMS_INVALID_NUMBER" ); + + build_time( &time, 2, 5, 1987, 8, 30, 45, 0 ); + status = rtems_timer_fire_when( Timer_id[ 1 ], &time, Delayed_routine, NULL ); + fatal_directive_status( + status, + RTEMS_INVALID_CLOCK, + "rtems_timer_fire_when with illegal time" + ); + print_time( + "TA1 - rtems_timer_fire_when - ", + &time, + " - RTEMS_INVALID_CLOCK\n" + ); + + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_set" ); + print_time( "TA1 - rtems_clock_get - ", &time, "\n" ); + + build_time( &time, 2, 5, 1990, 8, 30, 45, 0 ); + status = rtems_timer_fire_when( Timer_id[ 1 ], &time, Delayed_routine, NULL ); + fatal_directive_status( + status, + RTEMS_INVALID_CLOCK, + "rtems_timer_fire_when before current time" + ); + print_time( + "TA1 - rtems_timer_fire_when - ", + &time, + " - before RTEMS_INVALID_CLOCK\n" + ); +} diff --git a/c/src/tests/sptests/sp09/sp09.doc b/c/src/tests/sptests/sp09/sp09.doc new file mode 100644 index 0000000000..f4e8391c47 --- /dev/null +++ b/c/src/tests/sptests/sp09/sp09.doc @@ -0,0 +1,36 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test9 + +directives: + ex_init, ex_start, tm_tick, i_return, + t_create,t_delete, t_getreg, t_ident, t_restart, t_resume, t_setpri, + t_setreg, t_start, t_suspend, tm_delete, tm_get, + tm_set, tm_wkafter, tm_wkwhen, ev_receive, ev_send, sm_create, sm_delete, + sm_ident, sm_p, sm_v, q_broadcast, q_create, q_delete, q_ident, q_receive, + q_send, q_urgent, as_catch, as_send, as_return, rn_create, rn_delete, + rn_getseg, rn_ident, rn_retseg, pt_create, pt_delete, pt_getbug, pt_ident, + pt_retbuf, de_close, de_cntrl, de_init, de_open, de_read, de_write + +concepts: + + a. Verifies all error codes returned by the executive in single + processor configurations. + + b. Verifies error conditions in the following kernel routines or macros: + _Ck_date_time, _Expired, _Q_submit, _Get_mnodes, _Get_node, + _Free_mem, _Get_mem, _Valid_block, _Set_tcb, _Set_resource, + _In_range, _On_boundary diff --git a/c/src/tests/sptests/sp09/sp09.scn b/c/src/tests/sptests/sp09/sp09.scn new file mode 100644 index 0000000000..534fc47e09 --- /dev/null +++ b/c/src/tests/sptests/sp09/sp09.scn @@ -0,0 +1,249 @@ +*** TEST 9 *** +INIT - rtems_task_create - RTEMS_INVALID_SIZE -- NOT CHECKED +INIT - rtems_task_create - RTEMS_INVALID_PRIORITY +INIT - rtems_task_restart - RTEMS_INCORRECT_STATE +TA1 - rtems_task_delete - RTEMS_INVALID_ID +TA1 - rtems_task_get_note - RTEMS_INVALID_NUMBER +TA1 - rtems_task_get_note - RTEMS_INVALID_ID +TA1 - rtems_task_ident - current task RTEMS_SUCCESSFUL +TA1 - rtems_task_ident - global RTEMS_INVALID_NAME +TA1 - rtems_task_ident - local RTEMS_INVALID_NAME +TA1 - rtems_task_ident - RTEMS_INVALID_NODE +TA1 - rtems_task_restart - RTEMS_INVALID_ID +TA1 - rtems_task_resume - RTEMS_INVALID_ID +TA1 - rtems_task_resume - RTEMS_INCORRECT_STATE +TA1 - rtems_task_set_priority - RTEMS_INVALID_PRIORITY +TA1 - rtems_task_set_priority - RTEMS_INVALID_ID +TA1 - rtems_task_set_note - RTEMS_INVALID_NUMBER +TA1 - rtems_task_set_note - RTEMS_INVALID_ID +TA1 - rtems_task_start - RTEMS_INVALID_ID +TA1 - rtems_task_start - RTEMS_INCORRECT_STATE +TA1 - rtems_task_suspend - RTEMS_INVALID_ID + +TA1 - rtems_clock_get - RTEMS_NOT_DEFINED +TA1 - rtems_task_wake_when - RTEMS_NOT_DEFINED +TA1 - rtems_timer_fire_when - RTEMS_NOT_DEFINED +TA1 - rtems_clock_set - 08:30:45 02/05/1987 - RTEMS_INVALID_CLOCK +TA1 - rtems_clock_set - 08:30:45 15/05/1988 - RTEMS_INVALID_CLOCK +TA1 - rtems_clock_set - 08:30:45 02/32/1988 - RTEMS_INVALID_CLOCK +TA1 - rtems_clock_set - 25:30:45 02/05/1988 - RTEMS_INVALID_CLOCK +TA1 - rtems_clock_set - 08:61:45 02/05/1988 - RTEMS_INVALID_CLOCK +TA1 - rtems_clock_set - 08:30:61 02/05/1988 - RTEMS_INVALID_CLOCK +TA1 - rtems_clock_set - 08:30:45 02/05/1988 - RTEMS_INVALID_CLOCK +TA1 - rtems_clock_set - 08:30:45 02/05/1988 - RTEMS_SUCCESSFUL +TA1 - rtems_task_wake_when - TICKINVALID - sleep about 3 seconds +TA1 - rtems_task_wake_when - TICKINVALID - woke up RTEMS_SUCCESSFUL +TA1 - rtems_task_wake_when - 08:30:48 02/05/1961 - RTEMS_INVALID_CLOCK +TA1 - rtems_task_wake_when - 25:30:48 02/05/1988 - RTEMS_INVALID_CLOCK +TA1 - current time - 08:30:51 02/05/1988 +TA1 - rtems_task_wake_when - 08:30:51 01/05/1988 - RTEMS_INVALID_CLOCK + +TA1 - rtems_task_create - RTEMS_INVALID_NAME +TA1 - rtems_task_create - stack size - RTEMS_UNSATISFIED +TA1 - rtems_task_create - TA2 created - RTEMS_SUCCESSFUL +TA1 - rtems_task_suspend - suspend TA2 - RTEMS_SUCCESSFUL +TA1 - rtems_task_suspend - suspend TA2 - RTEMS_ALREADY_SUSPENDED +TA1 - rtems_task_resume - TA2 resumed - RTEMS_SUCCESSFUL +TA1 - rtems_task_create - TA3 created - RTEMS_SUCCESSFUL +TA1 - rtems_task_create - 4 created - RTEMS_SUCCESSFUL +TA1 - rtems_task_create - 5 created - RTEMS_SUCCESSFUL +TA1 - rtems_task_create - 6 created - RTEMS_SUCCESSFUL +TA1 - rtems_task_create - 7 created - RTEMS_SUCCESSFUL +TA1 - rtems_task_create - 8 created - RTEMS_SUCCESSFUL +TA1 - rtems_task_create - 9 created - RTEMS_SUCCESSFUL +TA1 - rtems_task_create - 10 created - RTEMS_SUCCESSFUL +TA1 - rtems_task_create - 11 - RTEMS_TOO_MANY +TA1 - rtems_task_create - RTEMS_MP_NOT_CONFIGURED + +TA1 - rtems_event_receive - RTEMS_UNSATISFIED ( all conditions ) +TA1 - rtems_event_receive - RTEMS_UNSATISFIED ( any condition ) +TA1 - rtems_event_receive - timeout in 3 seconds +TA1 - rtems_event_receive - woke up with RTEMS_TIMEOUT +TA1 - rtems_event_send - RTEMS_INVALID_ID +TA1 - rtems_task_wake_after - sleep 1 second - RTEMS_SUCCESSFUL +TA1 - rtems_clock_set - 08:30:45 02/05/1988 - RTEMS_SUCCESSFUL + +TA1 - rtems_semaphore_create - RTEMS_INVALID_NAME +TA1 - rtems_semaphore_create - 1 - RTEMS_SUCCESSFUL +TA1 - rtems_semaphore_create - 2 - RTEMS_SUCCESSFUL +TA1 - rtems_semaphore_create - 3 - RTEMS_TOO_MANY +TA1 - rtems_semaphore_create - RTEMS_NOT_DEFINED +TA1 - rtems_semaphore_create - RTEMS_NOT_DEFINED +TA1 - rtems_semaphore_create - RTEMS_INVALID_NUMBER +TA1 - rtems_semaphore_create - RTEMS_MP_NOT_CONFIGURED +TA1 - rtems_semaphore_delete - unknown RTEMS_INVALID_ID +TA1 - rtems_semaphore_delete - local RTEMS_INVALID_ID +TA1 - rtems_semaphore_ident - global RTEMS_INVALID_NAME +TA1 - rtems_semaphore_ident - local RTEMS_INVALID_NAME + +TA1 - rtems_semaphore_obtain - RTEMS_INVALID_ID +TA1 - rtems_semaphore_obtain - got sem 1 - RTEMS_SUCCESSFUL +TA1 - rtems_semaphore_obtain - RTEMS_UNSATISFIED +TA1 - rtems_semaphore_obtain - timeout in 3 seconds +TA1 - rtems_semaphore_obtain - woke up with RTEMS_TIMEOUT +TA1 - rtems_semaphore_release - RTEMS_NOT_OWNER_OF_RESOURCE +TA1 - rtems_semaphore_release - RTEMS_INVALID_ID +TA1 - rtems_task_start - start TA2 - RTEMS_SUCCESSFUL +TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL +TA2 - rtems_semaphore_obtain - sem 1 - RTEMS_WAIT FOREVER +TA1 - rtems_semaphore_delete - delete sem 1 - RTEMS_SUCCESSFUL +TA1 - rtems_semaphore_obtain - binary semaphore +TA1 - rtems_semaphore_delete - delete sem 2 - RTEMS_RESOURCE_IN_USE +TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL +TA2 - rtems_semaphore_obtain - woke up with RTEMS_OBJECT_WAS_DELETED +TA2 - rtems_task_delete - delete self - RTEMS_SUCCESSFUL + +TA1 - rtems_message_queue_broadcast - RTEMS_INVALID_ID +TA1 - rtems_message_queue_create - Q 1 - RTEMS_INVALID_NAME +TA1 - rtems_message_queue_create - Q 1 - RTEMS_MP_NOT_CONFIGURED +TA1 - rtems_message_queue_create - Q 1 - RTEMS_LIMIT - RTEMS_SUCCESSFUL +TA1 - rtems_message_queue_create - Q 2 - RTEMS_TOO_MANY +TA1 - rtems_message_queue_delete - unknown RTEMS_INVALID_ID +TA1 - rtems_message_queue_delete - local RTEMS_INVALID_ID +TA1 - rtems_message_queue_ident - RTEMS_INVALID_NAME +TA1 - rtems_message_queue_flush - RTEMS_INVALID_ID +TA1 - rtems_message_queue_receive - RTEMS_INVALID_ID +TA1 - rtems_message_queue_receive - Q 1 - RTEMS_UNSATISFIED +TA1 - rtems_message_queue_receive - Q 1 - timeout in 3 seconds +TA1 - rtems_message_queue_receive - Q 1 - woke up with RTEMS_TIMEOUT +TA1 - rtems_message_queue_send - RTEMS_INVALID_ID +TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1 - RTEMS_SUCCESSFUL +TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1 - RTEMS_SUCCESSFUL +TA1 - rtems_message_queue_send - BUFFER 3 TO Q 1 - RTEMS_TOO_MANY + +TA1 - rtems_message_queue_delete - Q 1 - RTEMS_SUCCESSFUL +TA1 - rtems_message_queue_create - Q 1 - RTEMS_LIMIT - RTEMS_SUCCESSFUL +TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1 - RTEMS_SUCCESSFUL +TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1 - RTEMS_SUCCESSFUL +TA1 - rtems_message_queue_send - BUFFER 3 TO Q 1 - RTEMS_TOO_MANY +TA1 - rtems_message_queue_delete - Q 1 - RTEMS_SUCCESSFUL +TA1 - rtems_message_queue_create - Q 1 - RTEMS_LIMIT - RTEMS_SUCCESSFUL +TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1 - RTEMS_SUCCESSFUL +TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1 - RTEMS_SUCCESSFUL +TA1 - rtems_message_queue_send - BUFFER 3 TO Q 1 - RTEMS_UNSATISFIED +TA1 - rtems_message_queue_delete - Q 1 - RTEMS_SUCCESSFUL +TA1 - rtems_message_queue_create - Q 1 - RTEMS_LIMIT - RTEMS_SUCCESSFUL +TA1 - rtems_task_start - start TA3 - RTEMS_SUCCESSFUL +TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL +TA3 - rtems_message_queue_receive - Q 1 - RTEMS_WAIT FOREVER +TA1 - rtems_message_queue_delete - delete Q 1 - RTEMS_SUCCESSFUL +TA1 - rtems_task_wake_after - yield processor - RTEMS_SUCCESSFUL +TA3 - rtems_message_queue_receive - woke up with RTEMS_OBJECT_WAS_DELETED +TA3 - rtems_task_delete - delete self - RTEMS_SUCCESSFUL + +TA1 - rtems_interrupt_catch - RTEMS_INVALID_NUMBER +TA1 - rtems_interrupt_catch - RTEMS_INVALID_ADDRESS +TA1 - rtems_signal_send - RTEMS_INVALID_ID +TA1 - rtems_signal_send - RTEMS_NOT_DEFINED +TA1 - rtems_port_create - RTEMS_INVALID_NAME +TA1 - rtems_port_create - RTEMS_INVALID_ADDRESS +TA1 - rtems_port_create - RTEMS_TOO_MANY +TA1 - rtems_port_delete - RTEMS_INVALID_ID +TA1 - rtems_port_ident - RTEMS_INVALID_NAME +TA1 - rtems_port_external_to_internal - RTEMS_INVALID_ID +TA1 - rtems_port_internal_to_external - RTEMS_INVALID_ID + +TA1 - rtems_rate_monotonic_create - RTEMS_INVALID_NAME +TA1 - rtems_rate_monotonic_create - RTEMS_SUCCESSFUL +TA1 - rtems_rate_monotonic_create - RTEMS_TOO_MANY +TA1 - rtems_rate_monotonic_ident - RTEMS_INVALID_NAME +TA1 - rtems_rate_monotonic_period - unknown RTEMS_INVALID_ID +TA1 - rtems_rate_monotonic_period - local RTEMS_INVALID_ID +TA1 - rtems_rate_monotonic_period(RTEMS_PERIOD_STATUS) - RTEMS_NOT_DEFINED +TA1 - rtems_rate_monotonic_period - 100 ticks - RTEMS_SUCCESSFUL +TA1 - rtems_rate_monotonic_period(RTEMS_PERIOD_STATUS) - RTEMS_SUCCESSFUL +TA1 - rtems_rate_monotonic_period(RTEMS_PERIOD_STATUS) - RTEMS_TIMEOUT +TA1 - rtems_rate_monotonic_cancel - unknown RTEMS_INVALID_ID +TA1 - rtems_rate_monotonic_cancel - local RTEMS_INVALID_ID +TA1 - rtems_rate_monotonic_cancel - RTEMS_SUCCESSFUL +TA1 - rtems_rate_monotonic_period - 5 ticks - RTEMS_TIMEOUT +TA1 - yielding to TA4 +TA4 - rtems_rate_monotonic_cancel - RTEMS_NOT_OWNER_OF_RESOURCE +TA4 - rtems_rate_monotonic_period - RTEMS_NOT_OWNER_OF_RESOURCE +TA4 - rtems_task_delete - delete self - RTEMS_SUCCESSFUL +TA1 - rtems_rate_monotonic_delete - unknown RTEMS_INVALID_ID +TA1 - rtems_rate_monotonic_delete - local RTEMS_INVALID_ID +TA1 - rtems_rate_monotonic_delete - RTEMS_SUCCESSFUL + +TA1 - rtems_partition_create - RTEMS_INVALID_NAME +TA1 - rtems_partition_create - length - RTEMS_INVALID_SIZE +TA1 - rtems_partition_create - buffer size - RTEMS_INVALID_SIZE +TA1 - rtems_partition_create - length < buffer size - RTEMS_INVALID_SIZE +TA1 - rtems_partition_create - RTEMS_MP_NOT_CONFIGURED +TA1 - rtems_partition_create - RTEMS_INVALID_ADDRESS +TA1 - rtems_partition_create - RTEMS_INVALID_SIZE +TA1 - rtems_partition_delete - unknown RTEMS_INVALID_ID +TA1 - rtems_partition_delete - local RTEMS_INVALID_ID +TA1 - rtems_partition_get_buffer - RTEMS_INVALID_ID +TA1 - rtems_partition_ident - RTEMS_INVALID_NAME +TA1 - rtems_partition_return_buffer - RTEMS_INVALID_ID +TA1 - rtems_partition_create - RTEMS_SUCCESSFUL +TA1 - rtems_partition_create - RTEMS_TOO_MANY +TA1 - rtems_partition_get_buffer - RTEMS_SUCCESSFUL +TA1 - rtems_partition_get_buffer - RTEMS_SUCCESSFUL +TA1 - rtems_partition_get_buffer - RTEMS_UNSATISFIED +TA1 - rtems_partition_delete - RTEMS_RESOURCE_IN_USE +TA1 - rtems_partition_return_buffer - RTEMS_INVALID_ADDRESS - out of range +TA1 - rtems_partition_return_buffer - RTEMS_INVALID_ADDRESS - not on boundary + +TA1 - rtems_region_create - RTEMS_INVALID_NAME +TA1 - rtems_region_create - RTEMS_INVALID_ADDRESS +TA1 - rtems_region_create - RTEMS_INVALID_SIZE +TA1 - rtems_region_create - RTEMS_SUCCESSFUL +TA1 - rtems_region_create - RTEMS_TOO_MANY +TA1 - rtems_region_delete - unknown RTEMS_INVALID_ID +TA1 - rtems_region_delete - local RTEMS_INVALID_ID +TA1 - rtems_region_ident - RTEMS_INVALID_NAME +TA1 - rtems_region_get_segment - RTEMS_INVALID_ID +TA1 - rtems_region_get_segment - RTEMS_INVALID_SIZE +TA1 - rtems_region_get_segment - RTEMS_SUCCESSFUL +TA1 - rtems_region_get_segment - RTEMS_UNSATISFIED +TA1 - rtems_region_get_segment - timeout in 3 seconds +TA1 - rtems_region_get_segment - woke up with RTEMS_TIMEOUT +TA1 - rtems_region_delete - RTEMS_RESOURCE_IN_USE +TA1 - rtems_region_return_segment - RTEMS_INVALID_ID +TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS +TA1 - rtems_debug_disable - RTEMS_DEBUG_REGION +TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS +TA1 - rtems_region_return_segment - RTEMS_INVALID_ADDRESS +TA1 - rtems_debug_enable - RTEMS_DEBUG_REGION +TA1 - rtems_region_extend - RTEMS_INVALID_ID +TA1 - rtems_region_extend - within heap - RTEMS_INVALID_ADDRESS +TA1 - rtems_region_extend - non-contiguous lower - RTEMS_NOT_IMPLEMENTED +TA1 - rtems_region_extend - contiguous lower - RTEMS_NOT_IMPLEMENTED +TA1 - rtems_region_extend - non-contiguous higher - RTEMS_NOT_IMPLEMENTED + +TA1 - rtems_io_close - RTEMS_INVALID_NUMBER +TA1 - rtems_io_control - RTEMS_INVALID_NUMBER +TA1 - rtems_io_initialize - RTEMS_INVALID_NUMBER +TA1 - rtems_io_open - RTEMS_INVALID_NUMBER +TA1 - rtems_io_read - RTEMS_INVALID_NUMBER +TA1 - rtems_io_write - RTEMS_INVALID_NUMBER +TA1 - rtems_clock_set - 23:59:59 12/31/2000 - RTEMS_SUCCESSFUL +TA1 - rtems_clock_get - 00:00:00 01/01/2001 - RTEMS_SUCCESSFUL +TA1 - rtems_clock_set - 23:59:59 12/31/1999 - RTEMS_SUCCESSFUL +TA1 - rtems_clock_get - 00:00:00 01/01/2000 - RTEMS_SUCCESSFUL +TA1 - rtems_clock_set - 23:59:59 12/31/2100 - RTEMS_SUCCESSFUL +TA1 - rtems_clock_get - 00:00:00 01/01/2101 - RTEMS_SUCCESSFUL +TA1 - rtems_clock_set - 23:59:59 12/31/2099 - RTEMS_SUCCESSFUL +TA1 - rtems_clock_get - 00:00:00 01/01/2100 - RTEMS_SUCCESSFUL +TA1 - rtems_clock_set - 23:59:59 12/31/1991 - RTEMS_SUCCESSFUL +TA1 - rtems_clock_get - 00:00:00 01/01/1992 - RTEMS_SUCCESSFUL + +TA1 - rtems_timer_create - RTEMS_INVALID_NAME +TA1 - rtems_timer_create - 1 - RTEMS_SUCCESSFUL +TA1 - rtems_timer_create - 2 - RTEMS_TOO_MANY +TA1 - rtems_timer_delete - local RTEMS_INVALID_ID +TA1 - rtems_timer_delete - global RTEMS_INVALID_ID +TA1 - rtems_timer_ident - RTEMS_INVALID_NAME +TA1 - rtems_timer_cancel - RTEMS_INVALID_ID +TA1 - rtems_timer_cancel - RTEMS_INCORRECT_STATE +TA1 - rtems_timer_reset - RTEMS_INVALID_ID +TA1 - rtems_timer_reset - RTEMS_NOT_DEFINED +TA1 - rtems_timer_fire_after - RTEMS_INVALID_ID +TA1 - rtems_timer_fire_when - RTEMS_INVALID_ID +TA1 - rtems_timer_fire_after - RTEMS_INVALID_NUMBER +TA1 - rtems_timer_fire_when - 08:30:45 02/05/1987 - RTEMS_INVALID_CLOCK +TA1 - rtems_clock_get - 00:00:00 01/01/1992 +TA1 - rtems_timer_fire_when - 08:30:45 02/05/1990 - before RTEMS_INVALID_CLOCK +*** END OF TEST 9 *** diff --git a/c/src/tests/sptests/sp09/system.h b/c/src/tests/sptests/sp09/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/c/src/tests/sptests/sp09/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/c/src/tests/sptests/sp09/task1.c b/c/src/tests/sptests/sp09/task1.c new file mode 100644 index 0000000000..dbf28f57a8 --- /dev/null +++ b/c/src/tests/sptests/sp09/task1.c @@ -0,0 +1,74 @@ +/* Task_1 + * + * This task generates all possible errors for the RTEMS executive. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +#ifdef pause +#undef pause +#endif + +rtems_task Task_1( + rtems_task_argument argument +) +{ + Screen1(); + pause_and_screen_number( 2 ); + + Screen2(); + pause_and_screen_number( 3 ); + + Screen3(); + pause_and_screen_number( 4 ); + + Screen4(); + pause_and_screen_number( 5 ); + + Screen5(); + pause_and_screen_number( 6 ); + + Screen6(); + pause_and_screen_number( 7 ); + + Screen7(); + pause_and_screen_number( 8 ); + + Screen8(); + pause_and_screen_number( 9 ); + + Screen9(); + pause_and_screen_number( 10 ); + + Screen10(); + pause_and_screen_number( 11 ); + + Screen11(); + pause_and_screen_number( 12 ); + + Screen12(); + pause_and_screen_number( 13 ); + + Screen13(); + pause_and_screen_number( 14 ); + + Screen14(); + + puts( "*** END OF TEST 9 ***" ); + exit( 0 ); +} diff --git a/c/src/tests/sptests/sp09/task2.c b/c/src/tests/sptests/sp09/task2.c new file mode 100644 index 0000000000..e9bda81fa3 --- /dev/null +++ b/c/src/tests/sptests/sp09/task2.c @@ -0,0 +1,48 @@ +/* Task_2 + * + * This routine serves as a test task. Its only purpose is to generate the + * error where a semaphore is deleted while a task is waiting for it. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_2( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "TA2 - rtems_semaphore_obtain - sem 1 - RTEMS_WAIT FOREVER" ); + status = rtems_semaphore_obtain( + Semaphore_id[ 1 ], + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + fatal_directive_status( + status, + RTEMS_OBJECT_WAS_DELETED, + "rtems_semaphore_obtain waiting to be deleted" + ); + puts( + "TA2 - rtems_semaphore_obtain - woke up with RTEMS_OBJECT_WAS_DELETED" + ); + + puts( "TA2 - rtems_task_delete - delete self - RTEMS_SUCCESSFUL" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of TA2" ); +} diff --git a/c/src/tests/sptests/sp09/task3.c b/c/src/tests/sptests/sp09/task3.c new file mode 100644 index 0000000000..8420c51f4d --- /dev/null +++ b/c/src/tests/sptests/sp09/task3.c @@ -0,0 +1,51 @@ +/* Task_3 + * + * This routine serves as a test task. Its only purpose in life is to + * generate the error where a message queue is deleted while a task + * is waiting there for a message. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_3( + rtems_task_argument argument +) +{ + rtems_status_code status; + long buffer[ 4 ]; + + puts( "TA3 - rtems_message_queue_receive - Q 1 - RTEMS_WAIT FOREVER" ); + status = rtems_message_queue_receive( + Queue_id[ 1 ], + (long (*)[4])buffer, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + fatal_directive_status( + status, + RTEMS_OBJECT_WAS_DELETED, + "rtems_message_queue_receive waiting to be deleted" + ); + puts( + "TA3 - rtems_message_queue_receive - woke up with RTEMS_OBJECT_WAS_DELETED" + ); + + puts( "TA3 - rtems_task_delete - delete self - RTEMS_SUCCESSFUL" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of TA3" ); +} diff --git a/c/src/tests/sptests/sp09/task4.c b/c/src/tests/sptests/sp09/task4.c new file mode 100644 index 0000000000..73cd63373c --- /dev/null +++ b/c/src/tests/sptests/sp09/task4.c @@ -0,0 +1,50 @@ +/* Task_4 + * + * This routine serves as a test task. Its only purpose in life is to + * generate the error where a rate monotonic period is accessed by a + * task other than its creator. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_4( + rtems_task_argument argument +) +{ + rtems_status_code status; + + status = rtems_rate_monotonic_cancel( Period_id[ 1 ] ); + fatal_directive_status( + status, + RTEMS_NOT_OWNER_OF_RESOURCE, + "rtems_rate_monotonic_cancel not the owner" + ); + puts( "TA4 - rtems_rate_monotonic_cancel - RTEMS_NOT_OWNER_OF_RESOURCE" ); + + status = rtems_rate_monotonic_period( Period_id[ 1 ], 5 ); + fatal_directive_status( + status, + RTEMS_NOT_OWNER_OF_RESOURCE, + "rtems_rate_monotonic_period not the owner" + ); + puts( "TA4 - rtems_rate_monotonic_period - RTEMS_NOT_OWNER_OF_RESOURCE" ); + + puts( "TA4 - rtems_task_delete - delete self - RTEMS_SUCCESSFUL" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of TA4" ); +} diff --git a/c/src/tests/sptests/sp11/init.c b/c/src/tests/sptests/sp11/init.c new file mode 100644 index 0000000000..99ef1d55a0 --- /dev/null +++ b/c/src/tests/sptests/sp11/init.c @@ -0,0 +1,95 @@ +/* Init + * + * This routine is the initialization task for this test program. + * It is a user initialization task and has the responsibility for creating + * and starting the tasks that make up the test. If the time of day + * clock is required for the test, it should also be set to a known + * value by this function. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TEST 11 ***" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_create( + Task_name[ 2 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create of TA2" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_start( Task_id[ 2 ], Task_2, 0 ); + directive_failed( status, "rtems_task_start of TA2" ); + + Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' ); + Timer_name[ 2 ] = rtems_build_name( 'T', 'M', '2', ' ' ); + Timer_name[ 3 ] = rtems_build_name( 'T', 'M', '3', ' ' ); + Timer_name[ 4 ] = rtems_build_name( 'T', 'M', '4', ' ' ); + Timer_name[ 5 ] = rtems_build_name( 'T', 'M', '5', ' ' ); + Timer_name[ 6 ] = rtems_build_name( 'T', 'M', '6', ' ' ); + + status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] ); + directive_failed( status, "rtems_timer_create of TM1" ); + + status = rtems_timer_create( Timer_name[ 2 ], &Timer_id[ 2 ] ); + directive_failed( status, "rtems_timer_create of TM2" ); + + status = rtems_timer_create( Timer_name[ 3 ], &Timer_id[ 3 ] ); + directive_failed( status, "rtems_timer_create of TM3" ); + + status = rtems_timer_create( Timer_name[ 4 ], &Timer_id[ 4 ] ); + directive_failed( status, "rtems_timer_create of TM4" ); + + status = rtems_timer_create( Timer_name[ 5 ], &Timer_id[ 5 ] ); + directive_failed( status, "rtems_timer_create of TM5" ); + + status = rtems_timer_create( Timer_name[ 6 ], &Timer_id[ 6 ] ); + directive_failed( status, "rtems_timer_create of TM6" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/c/src/tests/sptests/sp11/sp11.doc b/c/src/tests/sptests/sp11/sp11.doc new file mode 100644 index 0000000000..d88f5eb86d --- /dev/null +++ b/c/src/tests/sptests/sp11/sp11.doc @@ -0,0 +1,26 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test11 + +directives: + ex_init, ex_start, t_create, t_start, t_delete, tm_tick, i_return, + ev_send, ev_receive + tm_wkafter, tm_set, tm_get + +concepts: + + a. This test checks out the event manager along with the associated + event directives contained in the time manager. diff --git a/c/src/tests/sptests/sp11/sp11.scn b/c/src/tests/sptests/sp11/sp11.scn new file mode 100644 index 0000000000..7abb8afe45 --- /dev/null +++ b/c/src/tests/sptests/sp11/sp11.scn @@ -0,0 +1,74 @@ +*** TEST 11 *** +TA1 - rtems_event_send - send RTEMS_EVENT_16 to TA2 +TA1 - rtems_event_receive - waiting forever on RTEMS_EVENT_14 and RTEMS_EVENT_15 +TA2 - rtems_event_receive - waiting forever on RTEMS_EVENT_16 +TA2 - RTEMS_EVENT_16 received - eventout => 00010000 +TA2 - rtems_event_send - send RTEMS_EVENT_14 and RTEMS_EVENT_15 to TA1 +TA2 - rtems_event_receive - RTEMS_EVENT_17 or RTEMS_EVENT_18 - forever and ANY +TA1 - RTEMS_EVENT_14 and RTEMS_EVENT_15 received - eventout => 0000c000 +TA1 - rtems_event_send - send RTEMS_EVENT_18 to TA2 +TA1 - rtems_event_receive - waiting with 10 second timeout on RTEMS_EVENT_14 +TA2 - RTEMS_EVENT_17 or RTEMS_EVENT_18 received - eventout => 00040000 +TA2 - rtems_event_send - send RTEMS_EVENT_14 to TA1 +TA2 - rtems_clock_set - 08:15:00 02/12/1988 +TA2 - rtems_event_send - sending RTEMS_EVENT_10 to self after 5 seconds +TA2 - rtems_event_receive - waiting forever on RTEMS_EVENT_10 +TA1 - RTEMS_EVENT_14 received - eventout => 00004000 +TA1 - rtems_event_send - send RTEMS_EVENT_19 to TA2 +TA1 - rtems_clock_get - 08:15:00 02/12/1988 + +TA1 - rtems_event_send - send RTEMS_EVENT_18 to self after 5 seconds +TA1 - rtems_event_receive - waiting forever on RTEMS_EVENT_18 +TA2 - RTEMS_EVENT_10 received - eventout => 00000400 +TA2 - rtems_clock_get - 08:15:05 02/12/1988 +TA2 - rtems_event_receive - RTEMS_PENDING_EVENTS +TA2 - eventout => 00080000 +TA2 - rtems_event_receive - RTEMS_EVENT_19 - RTEMS_NO_WAIT +TA2 - RTEMS_EVENT_19 received - eventout => 00080000 +TA2 - rtems_task_delete - deletes self +TA1 - RTEMS_EVENT_18 received - eventout => 00040000 +TA1 - rtems_clock_get - 08:15:05 02/12/1988 +TA1 - rtems_event_send - send RTEMS_EVENT_3 to self +TA1 - rtems_event_receive - RTEMS_EVENT_3 or RTEMS_EVENT_22 - NO_WAIT and ANY +TA1 - RTEMS_EVENT_3 received - eventout => 00000008 +TA1 - rtems_event_send - send RTEMS_EVENT_4 to self +TA1 - rtems_event_receive - RTEMS_EVENT_4 or RTEMS_EVENT_5 - forever and ANY +TA1 - RTEMS_EVENT_4 received - eventout => 00000010 + +TA1 - rtems_event_send - send RTEMS_EVENT_18 to self after 5 seconds +TA1 - rtems_timer_cancel - cancelling timer for event RTEMS_EVENT_18 +TA1 - rtems_event_send - send RTEMS_EVENT_8 to self after 60 seconds +TA1 - rtems_event_send - send RTEMS_EVENT_9 to self after 60 seconds +TA1 - rtems_event_send - send RTEMS_EVENT_10 to self after 60 seconds +TA1 - rtems_timer_cancel - cancelling timer for event RTEMS_EVENT_8 +TA1 - rtems_clock_set - 08:15:00 02/12/1988 +TA1 - rtems_event_send - send RTEMS_EVENT_1 every second +TA1 - RTEMS_EVENT_1 received - eventout => 00000002 - at 08:15:01 02/12/1988 +TA1 - RTEMS_EVENT_1 received - eventout => 00000002 - at 08:15:02 02/12/1988 +TA1 - RTEMS_EVENT_1 received - eventout => 00000002 - at 08:15:03 02/12/1988 +TA1 - rtems_timer_cancel - cancelling timer for event RTEMS_EVENT_1 + +TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 1 day +TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 1 day +TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 2 days +TA1 - rtems_timer_cancel - cancelling RTEMS_EVENT_11 to self in 1 day +TA1 - rtems_timer_cancel - cancelling RTEMS_EVENT_11 to self in 2 days +TA1 - rtems_event_send - resending RTEMS_EVENT_11 to self in 2 days +TA1 - rtems_clock_set - 08:15:03 02/15/1988 +TA1 - rtems_event_receive - waiting forever on RTEMS_EVENT_11 +TA1 - RTEMS_EVENT_11 received - eventout => 00000800 + +TA1 - rtems_event_send/rtems_event_receive combination +TA1 - rtems_clock_set - 08:15:00 02/12/1988 +TA1 - rtems_event_receive all outstanding events +TA1 - rtems_event_send - sending RTEMS_EVENT_10 to self in 1 day +TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 2 days +TA1 - rtems_clock_set - 07:15:00 02/12/1988 +TA1 - set time backwards +TA1 - no events received +TA1 - rtems_clock_set - 07:15:00 02/14/1988 +TA1 - set time forwards (leave a timer) +TA1 - RTEMS_EVENT_10 received +TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 100 ticks +TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 200 ticks +*** END OF TEST 11 *** diff --git a/c/src/tests/sptests/sp11/system.h b/c/src/tests/sptests/sp11/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/c/src/tests/sptests/sp11/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/c/src/tests/sptests/sp11/task1.c b/c/src/tests/sptests/sp11/task1.c new file mode 100644 index 0000000000..1b2fc86040 --- /dev/null +++ b/c/src/tests/sptests/sp11/task1.c @@ -0,0 +1,410 @@ +/* Task_1 + * + * This routine serves as a test task. It verifies the event maager. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_event_set eventout; + rtems_time_of_day time; + rtems_status_code status; + rtems_unsigned32 index; + + puts( "TA1 - rtems_event_send - send RTEMS_EVENT_16 to TA2" ); + status = rtems_event_send( Task_id[ 2 ], RTEMS_EVENT_16 ); + directive_failed( status, "rtems_event_send" ); + + puts( + "TA1 - rtems_event_receive - waiting forever on " + "RTEMS_EVENT_14 and RTEMS_EVENT_15" + ); + status = rtems_event_receive( + RTEMS_EVENT_14 | RTEMS_EVENT_15, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &eventout + ); + directive_failed( status, "rtems_event_receive" ); + printf( + "TA1 - RTEMS_EVENT_14 and RTEMS_EVENT_15 received - eventout => %08x\n", + eventout + ); + + puts( "TA1 - rtems_event_send - send RTEMS_EVENT_18 to TA2" ); + status = rtems_event_send( Task_id[ 2 ], RTEMS_EVENT_18 ); + directive_failed( status, "rtems_event_send" ); + + puts( + "TA1 - rtems_event_receive - waiting with 10 second timeout on RTEMS_EVENT_14" + ); + status = rtems_event_receive( + RTEMS_EVENT_14, + RTEMS_DEFAULT_OPTIONS, + 10 * TICKS_PER_SECOND, + &eventout + ); + directive_failed( status, "rtems_event_receive" ); + printf( "TA1 - RTEMS_EVENT_14 received - eventout => %08x\n", eventout ); + + puts( "TA1 - rtems_event_send - send RTEMS_EVENT_19 to TA2" ); + status = rtems_event_send( Task_id[ 2 ], RTEMS_EVENT_19 ); + directive_failed( status, "rtems_event_send" ); + + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_get" ); + print_time( "TA1 - rtems_clock_get - ", &time, "\n" ); + +pause(); + + puts( "TA1 - rtems_event_send - send RTEMS_EVENT_18 to self after 5 seconds"); + status = rtems_timer_fire_after( + Timer_id[ 1 ], + 5 * TICKS_PER_SECOND, + TA1_send_18_to_self_5_seconds, + NULL + ); + directive_failed( status, "rtems_timer_fire_after 5 seconds" ); + + puts( "TA1 - rtems_event_receive - waiting forever on RTEMS_EVENT_18" ); + status = rtems_event_receive( + RTEMS_EVENT_18, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &eventout + ); + directive_failed( status, "rtems_event_receive of 18" ); + printf( "TA1 - RTEMS_EVENT_18 received - eventout => %08x\n", eventout ); + + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "TA1 rtems_clock_get" ); + print_time( "TA1 - rtems_clock_get - ", &time, "\n" ); + + puts( "TA1 - rtems_event_send - send RTEMS_EVENT_3 to self" ); + status = rtems_event_send( RTEMS_SELF, RTEMS_EVENT_3 ); + directive_failed( status, "rtems_event_send" ); + + puts( + "TA1 - rtems_event_receive - RTEMS_EVENT_3 or " + "RTEMS_EVENT_22 - NO_WAIT and ANY" + ); + status = rtems_event_receive( + RTEMS_EVENT_3 | RTEMS_EVENT_22, + RTEMS_NO_WAIT | RTEMS_EVENT_ANY, + RTEMS_NO_TIMEOUT, + &eventout + ); + directive_failed( status, "rtems_event_receive of 3 and 22" ); + printf( "TA1 - RTEMS_EVENT_3 received - eventout => %08x\n", eventout ); + + puts( "TA1 - rtems_event_send - send RTEMS_EVENT_4 to self" ); + status = rtems_event_send( RTEMS_SELF, RTEMS_EVENT_4 ); + directive_failed( status, "rtems_event_send" ); + + puts ( + "TA1 - rtems_event_receive - RTEMS_EVENT_4 or " + "RTEMS_EVENT_5 - forever and ANY" + ); + status = rtems_event_receive( + RTEMS_EVENT_4 | RTEMS_EVENT_5, + RTEMS_EVENT_ANY, + RTEMS_NO_TIMEOUT, + &eventout + ); + directive_failed( status, "rtems_event_receive" ); + printf( "TA1 - RTEMS_EVENT_4 received - eventout => %08x\n", eventout ); + +pause(); + + puts( "TA1 - rtems_event_send - send RTEMS_EVENT_18 to self after 5 seconds"); + status = rtems_timer_fire_after( + Timer_id[ 1 ], + 5 * TICKS_PER_SECOND, + TA1_send_18_to_self_5_seconds, + NULL + ); + directive_failed( status, "rtems_timer_fire_after 5 seconds" ); + + puts( "TA1 - rtems_timer_cancel - cancelling timer for event RTEMS_EVENT_18"); + status = rtems_timer_cancel( Timer_id[ 1 ] ); + directive_failed( status, "rtems_timer_cancel" ); + + puts( "TA1 - rtems_event_send - send RTEMS_EVENT_8 to self after 60 seconds"); + status = rtems_timer_fire_after( + Timer_id[ 1 ], + 60 * TICKS_PER_SECOND, + TA1_send_8_to_self_60_seconds, + NULL + ); + directive_failed( status, "rtems_timer_fire_after 60 seconds" ); + + puts( "TA1 - rtems_event_send - send RTEMS_EVENT_9 to self after 60 seconds"); + status = rtems_timer_fire_after( + Timer_id[ 2 ], + 60 * TICKS_PER_SECOND, + TA1_send_9_to_self_60_seconds, + NULL + ); + directive_failed( status, "rtems_timer_fire_after 60 seconds" ); + + puts( + "TA1 - rtems_event_send - send RTEMS_EVENT_10 to self after 60 seconds" + ); + status = rtems_timer_fire_after( + Timer_id[ 3 ], + 60 * TICKS_PER_SECOND, + TA1_send_10_to_self, + NULL + ); + directive_failed( status, "rtems_timer_fire_after 60 seconds" ); + + puts( "TA1 - rtems_timer_cancel - cancelling timer for event RTEMS_EVENT_8" ); + status = rtems_timer_cancel( Timer_id[ 1 ] ); + directive_failed( status, "rtems_timer_cancel" ); + + build_time( &time, 2, 12, 1988, 8, 15, 0, 0 ); + + print_time( "TA1 - rtems_clock_set - ", &time, "\n" ); + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + + puts( "TA1 - rtems_event_send - send RTEMS_EVENT_1 every second" ); + status = rtems_timer_fire_after( + Timer_id[ 1 ], + TICKS_PER_SECOND, + TA1_send_1_to_self_every_second, + NULL + ); + directive_failed( status, "rtems_timer_fire_after 1 second" ); + + for ( index = 0; index < 3; index++ ) { + + status = rtems_event_receive( + RTEMS_EVENT_1, + RTEMS_EVENT_ANY, + RTEMS_NO_TIMEOUT, + &eventout + ); + directive_failed( status, "rtems_event_receive" ); + + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_get" ); + + printf( "TA1 - RTEMS_EVENT_1 received - eventout => %08x - ", eventout ); + print_time( "at ", &time, "\n" ); + + if ( index < 2 ) { + status = rtems_timer_reset( Timer_id[ 1 ] ); + directive_failed( status, "rtems_timer_reset" ); + }; + + } + + puts( "TA1 - rtems_timer_cancel - cancelling timer for event RTEMS_EVENT_1" ); + status = rtems_timer_cancel( Timer_id[ 1 ] ); + directive_failed( status, "rtems_timer_cancel" ); + +pause(); + + time.day = 13; + puts( "TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 1 day" ); + status = rtems_timer_fire_when( + Timer_id[ 1 ], + &time, + TA1_send_11_to_self, + NULL + ); + directive_failed( status, "rtems_timer_fire_when 1 day" ); + + time.hour = 7; + puts( "TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 1 day" ); + status = rtems_timer_fire_when( + Timer_id[ 2 ], + &time, + TA1_send_11_to_self, + NULL + ); + directive_failed( status, "rtems_timer_fire_when 1 day" ); + + time.hour = 8; /* so code below has correct time/date */ + time.day = 14; + puts( "TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 2 days" ); + status = rtems_timer_fire_when( + Timer_id[ 3 ], + &time, + TA1_send_11_to_self, + NULL + ); + directive_failed( status, "rtems_timer_fire_when 2 days" ); + + puts("TA1 - rtems_timer_cancel - cancelling RTEMS_EVENT_11 to self in 1 day"); + status = rtems_timer_cancel( Timer_id[ 1 ] ); + directive_failed( status, "rtems_timer_cancel" ); + + puts( + "TA1 - rtems_timer_cancel - cancelling RTEMS_EVENT_11 to self in 2 days" + ); + status = rtems_timer_cancel( Timer_id[ 3 ] ); + directive_failed( status, "rtems_timer_cancel" ); + + puts( + "TA1 - rtems_event_send - resending RTEMS_EVENT_11 to self in 2 days" + ); + status = rtems_timer_fire_when( + Timer_id[ 3 ], + &time, + TA1_send_11_to_self, + NULL + ); + directive_failed( status, "rtems_timer_fire_when 2 days" ); + + time.day = 15; + print_time( "TA1 - rtems_clock_set - ", &time, "\n" ); + status = rtems_clock_set( &time ); + directive_failed( status, "TA1 rtems_clock_set" ); + + puts( "TA1 - rtems_event_receive - waiting forever on RTEMS_EVENT_11" ); + status = rtems_event_receive( + RTEMS_EVENT_11, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &eventout + ); + directive_failed( status, "rtems_event_receive" ); + printf( "TA1 - RTEMS_EVENT_11 received - eventout => %08x\n", eventout ); + +pause(); + + puts( "TA1 - rtems_event_send/rtems_event_receive combination" ); + status = rtems_timer_fire_after( + Timer_id[ 1 ], + 10, + TA1_send_11_to_self, + NULL + ); + directive_failed( status, "rtems_timer_fire_after 10 ticks" ); + + status = rtems_event_receive( + RTEMS_EVENT_11, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &eventout + ); + directive_failed( status, "rtems_event_receive" ); + + build_time( &time, 2, 12, 1988, 8, 15, 0, 0 ); + + print_time( "TA1 - rtems_clock_set - ", &time, "\n" ); + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + + time.day = 13; + puts( "TA1 - rtems_event_receive all outstanding events" ); + status = rtems_event_receive( + RTEMS_ALL_EVENTS, + RTEMS_NO_WAIT | RTEMS_EVENT_ANY, + 0, + &eventout + ); + fatal_directive_status( + status, + RTEMS_UNSATISFIED, + "rtems_event_receive all events" + ); + + puts( "TA1 - rtems_event_send - sending RTEMS_EVENT_10 to self in 1 day" ); + status = rtems_timer_fire_when( + Timer_id[ 1 ], + &time, + TA1_send_10_to_self, + NULL + ); + directive_failed( status, "rtems_timer_fire_when 1 day" ); + + time.day = 14; + puts( "TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 2 days" ); + status = rtems_timer_fire_when( + Timer_id[ 2 ], + &time, + TA1_send_11_to_self, + NULL + ); + directive_failed( status, "rtems_timer_fire_when 2 days" ); + + build_time( &time, 2, 12, 1988, 7, 15, 0, 0 ); + + print_time( "TA1 - rtems_clock_set - ", &time, "\n" ); + puts( "TA1 - set time backwards" ); + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + + status = rtems_event_receive( + RTEMS_ALL_EVENTS, + RTEMS_NO_WAIT | RTEMS_EVENT_ANY, + RTEMS_NO_TIMEOUT, + &eventout + ); + if ( eventout ) printf( "ERROR -0x%08x events received\n", eventout ); + else puts( "TA1 - no events received" ); + fatal_directive_status( + status, + RTEMS_UNSATISFIED, + "rtems_event_receive all events" + ); + + build_time( &time, 2, 14, 1988, 7, 15, 0, 0 ); + + print_time( "TA1 - rtems_clock_set - ", &time, "\n" ); + puts( "TA1 - set time forwards (leave a timer)" ); + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + + status = rtems_event_receive( + RTEMS_ALL_EVENTS, + RTEMS_NO_WAIT | RTEMS_EVENT_ANY, + RTEMS_NO_TIMEOUT, + &eventout + ); + if ( eventout == RTEMS_EVENT_10 ) puts( "TA1 - RTEMS_EVENT_10 received" ); + else printf( "ERROR -0x%08x events received\n", eventout ); + directive_failed( status, "rtems_event_receive all events" ); + + puts( "TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 100 ticks"); + status = rtems_timer_fire_after( + Timer_id[ 1 ], + 100, + TA1_send_11_to_self, + NULL + ); + directive_failed( status, "rtems_timer_fire_after 100 ticks" ); + + puts( "TA1 - rtems_event_send - sending RTEMS_EVENT_11 to self in 200 ticks"); + status = rtems_timer_fire_after( + Timer_id[ 1 ], + 200, + TA1_send_11_to_self, + NULL + ); + directive_failed( status, "rtems_timer_fire_after 200 ticks" ); + + puts( "*** END OF TEST 11 ***" ); + exit( 0 ); +} diff --git a/c/src/tests/sptests/sp11/task2.c b/c/src/tests/sptests/sp11/task2.c new file mode 100644 index 0000000000..176582bc36 --- /dev/null +++ b/c/src/tests/sptests/sp11/task2.c @@ -0,0 +1,126 @@ +/* Task_2 + * + * This routine serves as a test task. Multiple tasks are required to + * verify all capabilities of the event manager. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_2( + rtems_task_argument argument +) +{ + rtems_event_set eventout; + rtems_time_of_day time; + rtems_status_code status; + + status = rtems_task_wake_after( 1*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "TA2 - rtems_event_receive - waiting forever on RTEMS_EVENT_16" ); + status = rtems_event_receive( + RTEMS_EVENT_16, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &eventout + ); + directive_failed( status, "rtems_event_receive" ); + printf( "TA2 - RTEMS_EVENT_16 received - eventout => %08x\n", eventout ); + + puts( + "TA2 - rtems_event_send - send RTEMS_EVENT_14 and RTEMS_EVENT_15 to TA1" + ); + status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_14 | RTEMS_EVENT_15 ); + directive_failed( status, "rtems_event_send" ); + + puts( + "TA2 - rtems_event_receive - RTEMS_EVENT_17 or " + "RTEMS_EVENT_18 - forever and ANY" + ); + status = rtems_event_receive( + RTEMS_EVENT_17 | RTEMS_EVENT_18, + RTEMS_EVENT_ANY, + RTEMS_NO_TIMEOUT, + &eventout + ); + directive_failed( status, "rtems_event_receive" ); + printf( + "TA2 - RTEMS_EVENT_17 or RTEMS_EVENT_18 received - eventout => %08x\n", + eventout + ); + + puts( "TA2 - rtems_event_send - send RTEMS_EVENT_14 to TA1" ); + status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_14 ); + directive_failed( status, "rtems_event_send" ); + + build_time( &time, 2, 12, 1988, 8, 15, 0, 0 ); + print_time( "TA2 - rtems_clock_set - ", &time, "\n" ); + status = rtems_clock_set( &time ); + directive_failed( status, "TA2 rtems_clock_set" ); + + time.second += 5; + puts( + "TA2 - rtems_event_send - sending RTEMS_EVENT_10 to self after 5 seconds" + ); + status = rtems_timer_fire_when( + Timer_id[ 5 ], + &time, + TA2_send_10_to_self, + NULL + ); + directive_failed( status, "rtems_timer_fire_when after 5 seconds" ); + + puts( "TA2 - rtems_event_receive - waiting forever on RTEMS_EVENT_10" ); + status = rtems_event_receive( + RTEMS_EVENT_10, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &eventout + ); + directive_failed( status, "rtems_event_receive" ); + + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_get" ); + + printf( "TA2 - RTEMS_EVENT_10 received - eventout => %08x\n", eventout ); + print_time( "TA2 - rtems_clock_get - ", &time, "\n" ); + + puts( "TA2 - rtems_event_receive - RTEMS_PENDING_EVENTS" ); + status = rtems_event_receive( + RTEMS_PENDING_EVENTS, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &eventout + ); + directive_failed( status, "rtems_event_receive" ); + printf( "TA2 - eventout => %08x\n", eventout ); + + puts( "TA2 - rtems_event_receive - RTEMS_EVENT_19 - RTEMS_NO_WAIT" ); + status = rtems_event_receive( + RTEMS_EVENT_19, + RTEMS_NO_WAIT, + RTEMS_NO_TIMEOUT, + &eventout + ); + directive_failed( status, "rtems_event_receive" ); + printf( "TA2 - RTEMS_EVENT_19 received - eventout => %08x\n", eventout ); + + puts( "TA2 - rtems_task_delete - deletes self" ); + status = rtems_task_delete( Task_id[ 2 ] ); + directive_failed( status, "rtems_task_delete of TA2" ); +} diff --git a/c/src/tests/sptests/sp11/timer.c b/c/src/tests/sptests/sp11/timer.c new file mode 100644 index 0000000000..3ec11b7345 --- /dev/null +++ b/c/src/tests/sptests/sp11/timer.c @@ -0,0 +1,97 @@ +/* Timer_functions + * + * These routines are the timer service routines used by this test. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_timer_service_routine TA1_send_18_to_self_5_seconds( + rtems_id ignored_id, + void *ignored_address +) +{ + rtems_status_code status; + + status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_18 ); + directive_failed( status, "rtems_event_send of 18" ); +} + +rtems_timer_service_routine TA1_send_8_to_self_60_seconds( + rtems_id ignored_id, + void *ignored_address +) +{ + rtems_status_code status; + + status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_8 ); + directive_failed( status, "rtems_event_send of 8" ); +} + +rtems_timer_service_routine TA1_send_9_to_self_60_seconds( + rtems_id ignored_id, + void *ignored_address +) +{ + rtems_status_code status; + + status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_9 ); + directive_failed( status, "rtems_event_send of 9" ); +} + +rtems_timer_service_routine TA1_send_10_to_self( + rtems_id ignored_id, + void *ignored_address +) +{ + rtems_status_code status; + + status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_10 ); + directive_failed( status, "rtems_event_send of 10" ); +} + +rtems_timer_service_routine TA1_send_1_to_self_every_second( + rtems_id ignored_id, + void *ignored_address +) +{ + rtems_status_code status; + + status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_1 ); + directive_failed( status, "rtems_event_send of 1" ); +} + +rtems_timer_service_routine TA1_send_11_to_self( + rtems_id ignored_id, + void *ignored_address +) +{ + rtems_status_code status; + + status = rtems_event_send( Task_id[ 1 ], RTEMS_EVENT_11 ); + directive_failed( status, "rtems_event_send of 11" ); +} + +rtems_timer_service_routine TA2_send_10_to_self( + rtems_id ignored_id, + void *ignored_address +) +{ + rtems_status_code status; + + status = rtems_event_send( Task_id[ 2 ], RTEMS_EVENT_10 ); + directive_failed( status, "rtems_event_send of 10" ); +} diff --git a/c/src/tests/sptests/sp12/init.c b/c/src/tests/sptests/sp12/init.c new file mode 100644 index 0000000000..dd702ca75e --- /dev/null +++ b/c/src/tests/sptests/sp12/init.c @@ -0,0 +1,176 @@ +/* Init + * + * This routine is the initialization task for this test program. + * It is a user initialization task and has the responsibility for creating + * and starting the tasks that make up the test. If the time of day + * clock is required for the test, it should also be set to a known + * value by this function. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TEST 12 ***" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' ); + Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' ); + + Priority_task_name[ 1 ] = rtems_build_name( 'P', 'R', 'I', '1' ); + Priority_task_name[ 2 ] = rtems_build_name( 'P', 'R', 'I', '2' ); + Priority_task_name[ 3 ] = rtems_build_name( 'P', 'R', 'I', '3' ); + Priority_task_name[ 4 ] = rtems_build_name( 'P', 'R', 'I', '4' ); + Priority_task_name[ 5 ] = rtems_build_name( 'P', 'R', 'I', '5' ); + + Semaphore_name[ 1 ] = rtems_build_name( 'S', 'M', '1', ' ' ); + Semaphore_name[ 2 ] = rtems_build_name( 'S', 'M', '2', ' ' ); + Semaphore_name[ 3 ] = rtems_build_name( 'S', 'M', '3', ' ' ); + + status = rtems_semaphore_create( + Semaphore_name[ 1 ], + 1, + RTEMS_DEFAULT_ATTRIBUTES, + &Semaphore_id[ 1 ] + ); + directive_failed( status, "rtems_semaphore_create of SM1" ); + + status = rtems_semaphore_create( + Semaphore_name[ 2 ], + 0, + RTEMS_PRIORITY, + &Semaphore_id[ 2 ] + ); + directive_failed( status, "rtems_semaphore_create of SM2" ); + + status = rtems_semaphore_create( + Semaphore_name[ 3 ], + 1, + RTEMS_DEFAULT_ATTRIBUTES, + &Semaphore_id[ 3 ] + ); + directive_failed( status, "rtems_semaphore_create of SM3" ); + + puts( "INIT - Forward priority queue test" ); + Priority_test_driver( 0 ); + + puts( "INIT - Backward priority queue test" ); + Priority_test_driver( 32 ); + +pause(); + + puts( "INIT - Binary Semaphore and Priority Inheritance Test" ); + + status = rtems_semaphore_delete( Semaphore_id[ 2 ] ); + directive_failed( status, "rtems_semaphore_delete of SM2" ); + + puts( "INIT - rtems_semaphore_create - allocated binary semaphore" ); + status = rtems_semaphore_create( + Semaphore_name[ 2 ], + 0, + RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY, + &Semaphore_id[ 2 ] + ); + directive_failed( status, "rtems_semaphore_create of priority inherit SM2" ); + + puts( "INIT - rtems_semaphore_release - allocated binary semaphore" ); + status = rtems_semaphore_release( Semaphore_id[ 2 ] ); + directive_failed( status, "rtems_semaphore_release of SM2" ); + + puts( "INIT - rtems_semaphore_delete - allocated binary semaphore" ); + status = rtems_semaphore_delete( Semaphore_id[ 2 ] ); + directive_failed( status, "rtems_semaphore_delete of SM2" ); + + status = rtems_semaphore_create( + Semaphore_name[ 2 ], + 1, + RTEMS_BINARY_SEMAPHORE | RTEMS_PRIORITY | RTEMS_INHERIT_PRIORITY, + &Semaphore_id[ 2 ] + ); + directive_failed( status, "rtems_semaphore_create of priority inherit SM2" ); + + Priority_test_driver( 64 ); + +pause(); + + status = rtems_semaphore_delete( Semaphore_id[ 2 ] ); + directive_failed( status, "rtems_semaphore_delete of SM2" ); + + status = rtems_semaphore_create( + Semaphore_name[ 2 ], + 0, + RTEMS_PRIORITY, + &Semaphore_id[ 2 ] + ); + directive_failed( status, "rtems_semaphore_create of priority SM2" ); + + status = rtems_semaphore_release( Semaphore_id[ 2 ] ); + directive_failed( status, "rtems_semaphore_release of SM2" ); + + status = rtems_task_create( + Task_name[ 1 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_create( + Task_name[ 2 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create of TA2" ); + + status = rtems_task_create( + Task_name[ 3 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 3 ] + ); + directive_failed( status, "rtems_task_create of TA3" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_start( Task_id[ 2 ], Task_2, 0 ); + directive_failed( status, "rtems_task_start of TA2" ); + + status = rtems_task_start( Task_id[ 3 ], Task_3, 0 ); + directive_failed( status, "rtems_task_start of TA3" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/c/src/tests/sptests/sp12/pridrv.c b/c/src/tests/sptests/sp12/pridrv.c new file mode 100644 index 0000000000..7174faf784 --- /dev/null +++ b/c/src/tests/sptests/sp12/pridrv.c @@ -0,0 +1,131 @@ +/* Priority_test_driver + * + * This routine is the initialization task for this test program. + * It is a user initialization task and has the responsibility for creating + * and starting the tasks that make up the test. If the time of day + * clock is required for the test, it should also be set to a known + * value by this function. + * + * Input parameters: + * priority_base - priority_base switch + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Priority_test_driver( + rtems_unsigned32 priority_base +) +{ + rtems_task_priority previous_priority; + rtems_unsigned32 index; + rtems_status_code status; + + for ( index = 1 ; index <= 5 ; index++ ) { + switch ( index ) { + case 1: + case 2: + case 3: + Task_priority[ index ] = priority_base + index; + break; + default: + Task_priority[ index ] = priority_base + 3; + break; + } + + status = rtems_task_create( + Priority_task_name[ index ], + Task_priority[ index ], + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Priority_task_id[ index ] + ); + directive_failed( status, "rtems_task_create loop" ); + + } + + if ( priority_base == 0 ) { + for ( index = 1 ; index <= 5 ; index++ ) { + status = rtems_task_start( + Priority_task_id[ index ], + Priority_task, + index + ); + directive_failed( status, "rtems_task_start loop" ); + } + } else { + for ( index = 5 ; index >= 1 ; index-- ) { + status = rtems_task_start( + Priority_task_id[ index ], + Priority_task, + index + ); + directive_failed( status, "rtems_task_start loop" ); + + status = rtems_task_wake_after( TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after loop" ); + + if ( priority_base == 64 ) { + if ( index == 4 ) { + status = rtems_task_set_priority( + Priority_task_id[ 5 ], + priority_base + 4, + &previous_priority + ); + printf( "PDRV - change priority of PRI5 from %d to %d\n", + previous_priority, + priority_base + 4 + ); + directive_failed( status, "PDRV rtems_task_set_priority" ); + } + status = rtems_task_set_priority( + Priority_task_id[ 5 ], + RTEMS_CURRENT_PRIORITY, + &previous_priority + ); + directive_failed( status, "PDRV rtems_task_set_priority CURRENT" ); + printf( "PDRV - priority of PRI5 is %d\n", previous_priority ); + } + } + } + + status = rtems_task_wake_after( TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after after loop" ); + + if ( priority_base == 0 ) { + for ( index = 1 ; index <= 5 ; index++ ) { + status = rtems_semaphore_release( Semaphore_id[ 2 ] ); + directive_failed( status, "rtems_semaphore_release loop" ); + } + } + + if ( priority_base == 64 ) { + puts( "PDRV - rtems_task_resume - PRI5" ); + status = rtems_task_resume( Priority_task_id[ 5 ] ); + directive_failed( status, "rtems_task_resume" ); + + status = rtems_task_wake_after( 1 * TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after so PRI5 can run" ); + + status = rtems_task_delete( Priority_task_id[ 5 ] ); + directive_failed( status, "rtems_task_delete of PRI5" ); + } + else { + for ( index = 1 ; index <= 5 ; index++ ) { + status = rtems_task_delete( Priority_task_id[ index ] ); + directive_failed( status, "rtems_task_delete loop" ); + } + } +} diff --git a/c/src/tests/sptests/sp12/pritask.c b/c/src/tests/sptests/sp12/pritask.c new file mode 100644 index 0000000000..155ef345cd --- /dev/null +++ b/c/src/tests/sptests/sp12/pritask.c @@ -0,0 +1,91 @@ +/* Priority_task + * + * This routine serves as a test task. It verifies the semaphore manager. + * + * Input parameters: + * its_index - priority index + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Priority_task( + rtems_task_argument its_index +) +{ + rtems_interval timeout; + rtems_task_priority its_priority; + rtems_task_priority current_priority; + rtems_status_code status; + rtems_unsigned32 index; + + its_priority = Task_priority[ its_index ]; + + if ( its_priority < 3 ) + timeout = 5 * TICKS_PER_SECOND; + else + timeout = RTEMS_NO_TIMEOUT; + + put_name( Priority_task_name[ its_index ], FALSE ); + puts( " - rtems_semaphore_obtain - wait forever on SM2" ); + + status = rtems_semaphore_obtain( + Semaphore_id[ 2 ], + RTEMS_DEFAULT_OPTIONS, + timeout + ); + directive_failed( status, "rtems_semaphore_obtain of SM2" ); + + if ( its_priority < 64 ) { + printf( "PRI%d - WHY AM I HERE? (pri=%d)", its_index, its_priority ); + exit( 0 ); + } + + if ( its_index == 5 ) + puts( "PRI5 - rtems_task_suspend - until all priority tasks blocked" ); + status = rtems_task_suspend( RTEMS_SELF ); + directive_failed( status, "rtems_task_suspend" ); + + puts( "PRI5 - rtems_task_delete - all tasks waiting on SM2" ); + for ( index = 1 ; index < 5 ; index++ ) { + status = rtems_task_delete( Priority_task_id[ index ] ); + directive_failed( status, "rtems_task_delete loop" ); + } + + puts( "PRI5 - rtems_semaphore_obtain - nested" ); + status = rtems_semaphore_obtain( + Semaphore_id[ 2 ], + RTEMS_DEFAULT_OPTIONS, + timeout + ); + directive_failed( status, "rtems_semaphore_obtain nested" ); + + puts( "PRI5 - rtems_semaphore_release - nested" ); + status = rtems_semaphore_release( Semaphore_id[ 2 ] ); + directive_failed( status, "rtems_semaphore_release nested " ); + + puts( "PRI5 - rtems_semaphore_release - restore priority" ); + status = rtems_semaphore_release( Semaphore_id[ 2 ] ); + directive_failed( status, "rtems_semaphore_release" ); + + status = rtems_task_set_priority( + RTEMS_SELF, + RTEMS_CURRENT_PRIORITY, + ¤t_priority + ); + directive_failed( status, "PRI5 rtems_task_set_priority CURRENT" ); + printf( "PRI5 - priority of PRI5 is %d\n", current_priority ); + + (void) rtems_task_suspend( RTEMS_SELF ); +} diff --git a/c/src/tests/sptests/sp12/sp12.doc b/c/src/tests/sptests/sp12/sp12.doc new file mode 100644 index 0000000000..fc19d92ed7 --- /dev/null +++ b/c/src/tests/sptests/sp12/sp12.doc @@ -0,0 +1,27 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test12 + +directives: + ex_init, ex_start, t_create, t_start, t_delete, tm_tick, i_return, + sm_create, sm_ident, sm_delete, sm_p, sm_v, tm_wkafter, t_setpri + +concepts: + + a. This test checks out the semaphore manager. + + b. This test forces _Flush_taskq() to unblock a task waiting + on a deleted object. diff --git a/c/src/tests/sptests/sp12/sp12.scn b/c/src/tests/sptests/sp12/sp12.scn new file mode 100644 index 0000000000..82ceca3c6e --- /dev/null +++ b/c/src/tests/sptests/sp12/sp12.scn @@ -0,0 +1,78 @@ +*** TEST 12 *** +INIT - Forward priority queue test +PRI1 - rtems_semaphore_obtain - wait forever on SM2 +PRI2 - rtems_semaphore_obtain - wait forever on SM2 +PRI3 - rtems_semaphore_obtain - wait forever on SM2 +PRI4 - rtems_semaphore_obtain - wait forever on SM2 +PRI5 - rtems_semaphore_obtain - wait forever on SM2 +INIT - Backward priority queue test +PRI5 - rtems_semaphore_obtain - wait forever on SM2 +PRI4 - rtems_semaphore_obtain - wait forever on SM2 +PRI3 - rtems_semaphore_obtain - wait forever on SM2 +PRI2 - rtems_semaphore_obtain - wait forever on SM2 +PRI1 - rtems_semaphore_obtain - wait forever on SM2 + +INIT - Binary Semaphore and Priority Inheritance Test +INIT - rtems_semaphore_create - allocated binary semaphore +INIT - rtems_semaphore_release - allocated binary semaphore +INIT - rtems_semaphore_delete - allocated binary semaphore +PRI5 - rtems_semaphore_obtain - wait forever on SM2 +PRI5 - rtems_task_suspend - until all priority tasks blocked +PDRV - priority of PRI5 is 67 +PRI4 - rtems_semaphore_obtain - wait forever on SM2 +PDRV - change priority of PRI5 from 67 to 68 +PDRV - priority of PRI5 is 67 +PRI3 - rtems_semaphore_obtain - wait forever on SM2 +PDRV - priority of PRI5 is 67 +PRI2 - rtems_semaphore_obtain - wait forever on SM2 +PDRV - priority of PRI5 is 66 +PRI1 - rtems_semaphore_obtain - wait forever on SM2 +PDRV - priority of PRI5 is 65 +PDRV - rtems_task_resume - PRI5 +PRI5 - rtems_task_delete - all tasks waiting on SM2 +PRI5 - rtems_semaphore_obtain - nested +PRI5 - rtems_semaphore_release - nested +PRI5 - rtems_semaphore_release - restore priority +PRI5 - priority of PRI5 is 68 + +TA1 - rtems_semaphore_ident - smid => 00010001 +TA1 - rtems_semaphore_obtain - wait forever on SM2 +TA1 - got SM2 +TA1 - rtems_semaphore_obtain - wait forever on SM3 +TA1 - got SM3 +TA1 - rtems_semaphore_obtain - get SM1 - RTEMS_NO_WAIT +TA1 - got SM1 +TA1 - rtems_task_wake_after - sleep 5 seconds +TA2 - rtems_semaphore_obtain - wait forever on SM1 +TA3 - rtems_semaphore_obtain - wait forever on SM2 + +TA1 - rtems_semaphore_release - release SM1 +TA1 - rtems_semaphore_obtain - waiting for SM1 with 10 second timeout +TA2 - got SM1 +TA2 - rtems_semaphore_release - release SM1 +TA2 - rtems_task_set_priority - make self highest priority task +TA2 - rtems_semaphore_obtain - wait forever on SM2 +TA1 - got SM1 +TA1 - rtems_semaphore_release - release SM2 +TA2 - got SM2 +TA2 - rtems_semaphore_release - release SM2 +TA2 - rtems_task_delete - delete self +TA1 - rtems_task_wake_after - sleep 5 seconds +TA3 - got SM2 +TA3 - rtems_semaphore_release - release SM2 +TA3 - rtems_semaphore_obtain - wait forever on SM3 + +TA1 - rtems_task_delete - delete TA3 +TA1 - rtems_task_wake_after - sleep 5 seconds +TA4 - rtems_semaphore_obtain - wait forever on SM1 +TA5 - rtems_semaphore_obtain - wait forever on SM1 +TA1 - rtems_task_delete - delete TA4 +TA1 - rtems_semaphore_release - release SM1 +TA1 - rtems_task_wake_after - sleep 5 seconds +TA5 - got SM1 +TA5 - rtems_semaphore_obtain - wait forever on SM1 +TA1 - rtems_semaphore_delete - delete SM1 +TA1 - rtems_semaphore_delete - delete SM3 +TA1 - rtems_task_delete - delete self +TA5 - SM1 deleted by TA1 +*** END OF TEST 12 *** diff --git a/c/src/tests/sptests/sp12/system.h b/c/src/tests/sptests/sp12/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/c/src/tests/sptests/sp12/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/c/src/tests/sptests/sp12/task1.c b/c/src/tests/sptests/sp12/task1.c new file mode 100644 index 0000000000..d3d7f3ed15 --- /dev/null +++ b/c/src/tests/sptests/sp12/task1.c @@ -0,0 +1,153 @@ +/* Task_1 + * + * This routine serves as a test task. It verifies the semaphore manager. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_id smid; + rtems_status_code status; + + status = rtems_semaphore_ident( + Semaphore_name[ 1 ], + RTEMS_SEARCH_ALL_NODES, + &smid + ); + printf( "TA1 - rtems_semaphore_ident - smid => %08x\n", smid ); + directive_failed( status, "rtems_semaphore_ident of SM1" ); + + puts( "TA1 - rtems_semaphore_obtain - wait forever on SM2" ); + status = rtems_semaphore_obtain( + Semaphore_id[ 2 ], + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_semaphore_obtain of SM2" ); + puts( "TA1 - got SM2" ); + + puts( "TA1 - rtems_semaphore_obtain - wait forever on SM3" ); + status = rtems_semaphore_obtain( + Semaphore_id[ 3 ], + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_semaphore_obtain of SM3" ); + puts( "TA1 - got SM3" ); + + puts( "TA1 - rtems_semaphore_obtain - get SM1 - RTEMS_NO_WAIT" ); + status = rtems_semaphore_obtain( + Semaphore_id[ 1 ], + RTEMS_NO_WAIT, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_semaphore_obtain of SM1" ); + puts( "TA1 - got SM1" ); + + puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" ); + status = rtems_task_wake_after( 5*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + +pause(); + + puts( "TA1 - rtems_semaphore_release - release SM1" ); + status = rtems_semaphore_release( Semaphore_id[ 1 ] ); + directive_failed( status, "rtems_semaphore_release of SM1" ); + + puts( + "TA1 - rtems_semaphore_obtain - waiting for SM1 with 10 second timeout" + ); + status = rtems_semaphore_obtain( + Semaphore_id[ 1 ], + RTEMS_DEFAULT_OPTIONS, + 10 * TICKS_PER_SECOND + ); + directive_failed( status, "rtems_semaphore_obtain of SM1" ); + puts( "TA1 - got SM1" ); + + puts( "TA1 - rtems_semaphore_release - release SM2" ); + status = rtems_semaphore_release( Semaphore_id[ 2 ] ); + directive_failed( status, "rtems_semaphore_release of SM2" ); + + puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" ); + status = rtems_task_wake_after( 5*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + +pause(); + + puts( "TA1 - rtems_task_delete - delete TA3" ); + status = rtems_task_delete( Task_id[ 3 ] ); + directive_failed( status, "rtems_task_delete of TA3" ); + + status = rtems_task_create( + Task_name[ 4 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 4 ] + ); + directive_failed( status, "rtems_task_create of TA4" ); + + status = rtems_task_create( + Task_name[ 5 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 5 ] + ); + directive_failed( status, "rtems_task_create of TA5" ); + + status = rtems_task_start( Task_id[ 4 ], Task_4, 0 ); + directive_failed( status, "rtems_task_start of TA4" ); + + status = rtems_task_start( Task_id[ 5 ], Task5, 0 ); + directive_failed( status, "rtems_task_start of TA5" ); + + puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" ); + status = rtems_task_wake_after( 5*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "TA1 - rtems_task_delete - delete TA4" ); + status = rtems_task_delete( Task_id[ 4 ] ); + directive_failed( status, "rtems_task_delete of TA4" ); + + puts( "TA1 - rtems_semaphore_release - release SM1" ); + status = rtems_semaphore_release( Semaphore_id[ 1 ] ); + directive_failed( status, "rtems_semaphore_release on SM1" ); + + puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" ); + status = rtems_task_wake_after( 5*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "TA1 - rtems_semaphore_delete - delete SM1" ); + status = rtems_semaphore_delete( Semaphore_id[ 1 ] ); + directive_failed( status, "rtems_semaphore_delete of SM1" ); + + puts( "TA1 - rtems_semaphore_delete - delete SM3" ); + status = rtems_semaphore_delete( Semaphore_id[ 3 ] ); + directive_failed( status, "rtems_semaphore_delete of SM3" ); + + puts( "TA1 - rtems_task_delete - delete self" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of TA1" ); +} diff --git a/c/src/tests/sptests/sp12/task2.c b/c/src/tests/sptests/sp12/task2.c new file mode 100644 index 0000000000..41d6735162 --- /dev/null +++ b/c/src/tests/sptests/sp12/task2.c @@ -0,0 +1,65 @@ +/* Task_2 + * + * This routine serves as a test task. It simply obtains semaphores + * 1 and 2, the later when it is a high priority task. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +#include "system.h" + +rtems_task Task_2( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_task_priority previous_priority; + + puts( "TA2 - rtems_semaphore_obtain - wait forever on SM1" ); + status = rtems_semaphore_obtain( + Semaphore_id[ 1 ], + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + puts( "TA2 - got SM1" ); + directive_failed( status, "rtems_semaphore_obtain on SM1" ); + + puts( "TA2 - rtems_semaphore_release - release SM1" ); + status = rtems_semaphore_release( Semaphore_id[ 1 ] ); + directive_failed( status, "rtems_semaphore_release on SM1" ); + + puts( "TA2 - rtems_task_set_priority - make self highest priority task" ); + status = rtems_task_set_priority( RTEMS_SELF, 3, &previous_priority ); + directive_failed( status, "rtems_task_set_priority on TA2" ); + + puts( "TA2 - rtems_semaphore_obtain - wait forever on SM2" ); + status = rtems_semaphore_obtain( + Semaphore_id[ 2 ], + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + puts( "TA2 - got SM2" ); + directive_failed( status, "rtems_semaphore_obtain on SM2" ); + + puts( "TA2 - rtems_semaphore_release - release SM2" ); + status = rtems_semaphore_release( Semaphore_id[ 2 ] ); + directive_failed( status, "rtems_semaphore_release on SM2" ); + + puts( "TA2 - rtems_task_delete - delete self" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of TA2" ); +} diff --git a/c/src/tests/sptests/sp12/task3.c b/c/src/tests/sptests/sp12/task3.c new file mode 100644 index 0000000000..7340b84ce6 --- /dev/null +++ b/c/src/tests/sptests/sp12/task3.c @@ -0,0 +1,50 @@ +/* Task_3 + * + * This routine serves as a test task. It simply obtains semaphore + * 2 and waits forever attempting to obtain semaphore 3. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_3( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "TA3 - rtems_semaphore_obtain - wait forever on SM2" ); + status = rtems_semaphore_obtain( + Semaphore_id[ 2 ], + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_semaphore_obtain on SM2" ); + puts( "TA3 - got SM2" ); + + puts( "TA3 - rtems_semaphore_release - release SM2" ); + status = rtems_semaphore_release( Semaphore_id[ 2 ] ); + directive_failed( status, "rtems_semaphore_release on SM2" ); + + puts( "TA3 - rtems_semaphore_obtain - wait forever on SM3" ); + status = rtems_semaphore_obtain( + Semaphore_id[ 3 ], + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_semaphore_obtain on SM3" ); +} diff --git a/c/src/tests/sptests/sp12/task4.c b/c/src/tests/sptests/sp12/task4.c new file mode 100644 index 0000000000..9a0e952613 --- /dev/null +++ b/c/src/tests/sptests/sp12/task4.c @@ -0,0 +1,37 @@ +/* Task_4 + * + * This routine serves as a test task. It waits forever attempting + * to obtain semaphore 1. However, it should never get the semaphore! + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_4( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "TA4 - rtems_semaphore_obtain - wait forever on SM1" ); + status = rtems_semaphore_obtain( + Semaphore_id[ 1 ], + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_semaphore_obtain on SM1" ); +} diff --git a/c/src/tests/sptests/sp12/task5.c b/c/src/tests/sptests/sp12/task5.c new file mode 100644 index 0000000000..ccf10cd11a --- /dev/null +++ b/c/src/tests/sptests/sp12/task5.c @@ -0,0 +1,55 @@ +/* Task5 + * + * This routine serves as a test task. It obtains semaphore 1 correctly + * once, then waits for semaphore 1 again. Task 1 should delete the + * semaphore, thus waking this task up. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task5( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "TA5 - rtems_semaphore_obtain - wait forever on SM1" ); + status = rtems_semaphore_obtain( + Semaphore_id[ 1 ], + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_semaphore_obtain on SM1" ); + puts( "TA5 - got SM1" ); + + puts( "TA5 - rtems_semaphore_obtain - wait forever on SM1" ); + status = rtems_semaphore_obtain( + Semaphore_id[ 1 ], + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + fatal_directive_status( + status, + RTEMS_OBJECT_WAS_DELETED, + "rtems_semaphore_obtain on SM1" + ); + puts( "TA5 - SM1 deleted by TA1" ); + + puts( "*** END OF TEST 12 ***" ); + exit( 0 ); +} diff --git a/c/src/tests/sptests/sp13/fillbuff.c b/c/src/tests/sptests/sp13/fillbuff.c new file mode 100644 index 0000000000..43ccd86803 --- /dev/null +++ b/c/src/tests/sptests/sp13/fillbuff.c @@ -0,0 +1,31 @@ +/* Fill_buffer + * + * This test routine copies a given source string to a given destination + * buffer. + * + * Input parameters: + * source - pointer to string to be copied + * buffer - pointer to message buffer to be filled + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Fill_buffer( + char *source, + long *buffer +) +{ + memcpy( buffer, source, 16 ); +} diff --git a/c/src/tests/sptests/sp13/init.c b/c/src/tests/sptests/sp13/init.c new file mode 100644 index 0000000000..0629cdff21 --- /dev/null +++ b/c/src/tests/sptests/sp13/init.c @@ -0,0 +1,112 @@ +/* Init + * + * This routine is the initialization task for this test program. + * It is a user initialization task and has the responsibility for creating + * and starting the tasks that make up the test. If the time of day + * clock is required for the test, it should also be set to a known + * value by this function. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TEST 13 ***" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_create( + Task_name[ 2 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create of TA2" ); + + status = rtems_task_create( + Task_name[ 3 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 3 ] + ); + directive_failed( status, "rtems_task_create of TA3" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_start( Task_id[ 2 ], Task_2, 0 ); + directive_failed( status, "rtems_task_start of TA2" ); + + status = rtems_task_start( Task_id[ 3 ], Task_3, 0 ); + directive_failed( status, "rtems_task_start of TA3" ); + + Queue_name[ 1 ] = rtems_build_name( 'Q', '1', ' ', ' ' ); + Queue_name[ 2 ] = rtems_build_name( 'Q', '2', ' ', ' ' ); + Queue_name[ 3 ] = rtems_build_name( 'Q', '3', ' ', ' ' ); + + status = rtems_message_queue_create( + Queue_name[ 1 ], + 0, + RTEMS_DEFAULT_ATTRIBUTES, + &Queue_id[ 1 ] + ); + directive_failed( status, "rtems_message_queue_create of Q1" ); + + status = rtems_message_queue_create( + Queue_name[ 2 ], + 10, + RTEMS_PRIORITY | RTEMS_LIMIT, + &Queue_id[ 2 ] + ); + directive_failed( status, "rtems_message_queue_create of Q2" ); + + status = rtems_message_queue_create( + Queue_name[ 3 ], + 0, + RTEMS_DEFAULT_ATTRIBUTES, + &Queue_id[ 3 ] + ); + directive_failed( status, "rtems_message_queue_create of Q3" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/c/src/tests/sptests/sp13/putbuff.c b/c/src/tests/sptests/sp13/putbuff.c new file mode 100644 index 0000000000..e0bbfa4d7f --- /dev/null +++ b/c/src/tests/sptests/sp13/putbuff.c @@ -0,0 +1,31 @@ +/* Put_buffer + * + * This test routine prints the given buffer. + * buffer. + * + * Input parameters: + * buffer - pointer to message buffer to be printer + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +#define BUFFER_LENGTH 16 + +void Put_buffer( + long *buffer +) +{ + printf( "%16s", (char *)buffer ); +} diff --git a/c/src/tests/sptests/sp13/sp13.doc b/c/src/tests/sptests/sp13/sp13.doc new file mode 100644 index 0000000000..4a0c9d24a0 --- /dev/null +++ b/c/src/tests/sptests/sp13/sp13.doc @@ -0,0 +1,25 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test13 + +directives: + ex_init, ex_start, t_create, t_start, t_delete, tm_tick, i_return, + q_create, q_ident, q_delete, q_send, q_urgent, q_broadcast, q_receive, + tm_wkafter, t_setpri + +concepts: + + a. This test checks out the message manager. diff --git a/c/src/tests/sptests/sp13/sp13.scn b/c/src/tests/sptests/sp13/sp13.scn new file mode 100644 index 0000000000..bd3af7da48 --- /dev/null +++ b/c/src/tests/sptests/sp13/sp13.scn @@ -0,0 +1,66 @@ +*** TEST 13 *** +TA1 - rtems_message_queue_ident - qid => 00010001 +TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1 +TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1 +TA1 - rtems_task_wake_after - sleep 5 seconds +TA2 - rtems_message_queue_receive - receive from queue 1 - RTEMS_NO_WAIT +TA2 - buffer received: BUFFER 1 TO Q 1 +TA2 - rtems_message_queue_receive - receive from queue 1 - RTEMS_WAIT FOREVER +TA2 - buffer received: BUFFER 2 TO Q 1 +TA2 - rtems_message_queue_receive - receive from queue 1 - RTEMS_WAIT FOREVER +TA3 - rtems_message_queue_receive - receive from queue 2 - RTEMS_WAIT FOREVER +TA1 - rtems_message_queue_send - BUFFER 3 TO Q 1 +TA1 - rtems_task_wake_after - sleep 5 seconds +TA2 - buffer received: BUFFER 3 TO Q 1 +TA2 - rtems_task_set_priority - make self highest priority task +TA2 - rtems_message_queue_receive - receive from queue 2 - RTEMS_WAIT FOREVER + +TA1 - rtems_message_queue_send - BUFFER 1 TO Q 2 +TA2 - buffer received: BUFFER 1 TO Q 2 +TA2 - rtems_message_queue_send - BUFFER 2 TO Q 2 +TA2 - rtems_message_queue_receive - receive from queue 1 - 10 second timeout +TA1 - rtems_message_queue_receive - receive from queue 1 - 10 second timeout +TA3 - buffer received: BUFFER 2 TO Q 2 +TA3 - rtems_message_queue_broadcast - BUFFER 3 TO Q 1 +TA2 - buffer received: BUFFER 3 TO Q 1 +TA2 - rtems_message_queue_receive - receive from queue 3 - RTEMS_WAIT FOREVER +TA3 - number of tasks awakened = 02 +TA3 - rtems_message_queue_receive - receive from queue 3 - RTEMS_WAIT FOREVER +TA1 - buffer received: BUFFER 3 TO Q 1 +TA1 - rtems_task_delete - delete TA2 +TA1 - rtems_message_queue_send - BUFFER 1 TO Q 3 +TA1 - rtems_task_wake_after - sleep 5 seconds +TA3 - buffer received: BUFFER 1 TO Q 3 +TA3 - rtems_task_delete - delete self + +TA1 - rtems_message_queue_send - BUFFER 2 TO Q 3 +TA1 - rtems_message_queue_send - BUFFER 3 TO Q 3 +TA1 - rtems_message_queue_send - BUFFER 4 TO Q 3 +TA1 - rtems_message_queue_urgent - BUFFER 5 TO Q 3 +TA1 - rtems_message_queue_receive - receive from queue 3 - RTEMS_WAIT FOREVER +TA1 - buffer received: BUFFER 5 TO Q 3 +TA1 - rtems_message_queue_receive - receive from queue 3 - RTEMS_WAIT FOREVER +TA1 - buffer received: BUFFER 2 TO Q 3 +TA1 - rtems_message_queue_receive - receive from queue 3 - RTEMS_WAIT FOREVER +TA1 - buffer received: BUFFER 3 TO Q 3 +TA1 - rtems_message_queue_receive - receive from queue 3 - RTEMS_WAIT FOREVER +TA1 - buffer received: BUFFER 4 TO Q 3 +TA1 - rtems_message_queue_urgent - BUFFER 3 TO Q 2 +TA1 - rtems_message_queue_receive - receive from queue 2 - RTEMS_WAIT FOREVER +TA1 - buffer received: BUFFER 3 TO Q 2 + +TA1 - rtems_message_queue_delete - delete queue 1 +TA1 - rtems_message_queue_urgent - BUFFER 3 TO Q 2 +TA1 - rtems_message_queue_delete - delete queue 2 +TA1 - rtems_message_queue_flush - empty Q 3 +TA1 - 0 messages were flushed from Q 3 +TA1 - rtems_message_queue_send - BUFFER 1 TO Q 3 +TA1 - rtems_message_queue_send - BUFFER 2 TO Q 3 +TA1 - rtems_message_queue_send - BUFFER 3 TO Q 3 +TA1 - rtems_message_queue_flush - Q 3 +TA1 - 3 messages were flushed from Q 3 +TA1 - rtems_message_queue_send until all message buffers consumed +TA1 - all message buffers consumed +TA1 - rtems_message_queue_flush - Q 3 +TA1 - 100 messages were flushed from Q 3 +*** END OF TEST 13 *** diff --git a/c/src/tests/sptests/sp13/system.h b/c/src/tests/sptests/sp13/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/c/src/tests/sptests/sp13/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/c/src/tests/sptests/sp13/task1.c b/c/src/tests/sptests/sp13/task1.c new file mode 100644 index 0000000000..89c0619025 --- /dev/null +++ b/c/src/tests/sptests/sp13/task1.c @@ -0,0 +1,213 @@ +/* Task_1 + * + * This routine serves as a test task. It verifies the message manager. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +extern rtems_configuration_table BSP_Configuration; + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_id qid; + long buffer[ 4 ]; + rtems_unsigned32 index; + rtems_unsigned32 count; + rtems_status_code status; + + status = rtems_message_queue_ident( + Queue_name[ 1 ], + RTEMS_SEARCH_ALL_NODES, + &qid + ); + printf( "TA1 - rtems_message_queue_ident - qid => %08x\n", qid ); + directive_failed( status, "rtems_message_queue_ident" ); + + Fill_buffer( "BUFFER 1 TO Q 1", buffer ); + puts( "TA1 - rtems_message_queue_send - BUFFER 1 TO Q 1" ); + status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer ); + directive_failed( status, "rtems_message_queue_send" ); + + Fill_buffer( "BUFFER 2 TO Q 1", buffer ); + puts( "TA1 - rtems_message_queue_send - BUFFER 2 TO Q 1" ); + status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer ); + directive_failed( status, "rtems_message_queue_send" ); + + puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" ); + status = rtems_task_wake_after( 5*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + Fill_buffer( "BUFFER 3 TO Q 1", buffer ); + puts( "TA1 - rtems_message_queue_send - BUFFER 3 TO Q 1" ); + status = rtems_message_queue_send( Queue_id[ 1 ], (long (*)[4])buffer ); + directive_failed( status, "rtems_message_queue_send" ); + + puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" ); + status = rtems_task_wake_after( 5*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + +pause(); + + Fill_buffer( "BUFFER 1 TO Q 2", buffer ); + puts( "TA1 - rtems_message_queue_send - BUFFER 1 TO Q 2" ); + status = rtems_message_queue_send( Queue_id[ 2 ], (long (*)[4])buffer ); + directive_failed( status, "rtems_message_queue_send" ); + + puts_nocr( "TA1 - rtems_message_queue_receive - receive from queue 1 - " ); + puts ( "10 second timeout" ); + status = rtems_message_queue_receive( + Queue_id[ 1 ], + (long (*)[4])buffer, + RTEMS_DEFAULT_OPTIONS, + 10 * TICKS_PER_SECOND + ); + directive_failed( status, "rtems_message_queue_receive" ); + puts_nocr( "TA1 - buffer received: " ); + Put_buffer( buffer ); + new_line; + + puts( "TA1 - rtems_task_delete - delete TA2" ); + status = rtems_task_delete( Task_id[ 2 ] ); + directive_failed( status, "rtems_task_delete" ); + + Fill_buffer( "BUFFER 1 TO Q 3", buffer ); + puts( "TA1 - rtems_message_queue_send - BUFFER 1 TO Q 3" ); + status = rtems_message_queue_send( Queue_id[ 3 ], (long (*)[4])buffer ); + directive_failed( status, "rtems_message_queue_send" ); + + puts( "TA1 - rtems_task_wake_after - sleep 5 seconds" ); + status = rtems_task_wake_after( 5*TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + +pause(); + + Fill_buffer( "BUFFER 2 TO Q 3", buffer ); + puts( "TA1 - rtems_message_queue_send - BUFFER 2 TO Q 3" ); + status = rtems_message_queue_send( Queue_id[ 3 ], (long (*)[4])buffer ); + directive_failed( status, "rtems_message_queue_send" ); + + Fill_buffer( "BUFFER 3 TO Q 3", buffer ); + puts( "TA1 - rtems_message_queue_send - BUFFER 3 TO Q 3" ); + status = rtems_message_queue_send( Queue_id[ 3 ], (long (*)[4])buffer ); + directive_failed( status, "rtems_message_queue_send" ); + + Fill_buffer( "BUFFER 4 TO Q 3", buffer ); + puts( "TA1 - rtems_message_queue_send - BUFFER 4 TO Q 3" ); + status = rtems_message_queue_send( Queue_id[ 3 ], (long (*)[4])buffer ); + directive_failed( status, "rtems_message_queue_send" ); + + Fill_buffer( "BUFFER 5 TO Q 3", buffer ); + puts( "TA1 - rtems_message_queue_urgent - BUFFER 5 TO Q 3" ); + status = rtems_message_queue_urgent( Queue_id[ 3 ], (long (*)[4])buffer ); + directive_failed( status, "rtems_message_queue_urgent" ); + + for ( index = 1 ; index <= 4 ; index++ ) { + puts( + "TA1 - rtems_message_queue_receive - receive from queue 3 - " + "RTEMS_WAIT FOREVER" + ); + status = rtems_message_queue_receive( + Queue_id[ 3 ], + (long (*)[4])buffer, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_message_queue_receive" ); + puts_nocr( "TA1 - buffer received: " ); + Put_buffer( buffer ); + new_line; + } + + Fill_buffer( "BUFFER 3 TO Q 2", buffer ); + puts( "TA1 - rtems_message_queue_urgent - BUFFER 3 TO Q 2" ); + status = rtems_message_queue_urgent( Queue_id[ 2 ], (long (*)[4])buffer ); + directive_failed( status, "rtems_message_queue_urgent" ); + + puts( + "TA1 - rtems_message_queue_receive - receive from queue 2 - " + "RTEMS_WAIT FOREVER" + ); + status = rtems_message_queue_receive( + Queue_id[ 2 ], + (long (*)[4])buffer, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_message_queue_receive" ); + puts_nocr( "TA1 - buffer received: " ); + Put_buffer( buffer ); + new_line; + +pause(); + + puts( "TA1 - rtems_message_queue_delete - delete queue 1" ); + status = rtems_message_queue_delete( Queue_id[ 1 ] ); + directive_failed( status, "rtems_message_queue_delete" ); + + Fill_buffer( "BUFFER 3 TO Q 2", buffer ); + puts( "TA1 - rtems_message_queue_urgent - BUFFER 3 TO Q 2" ); + status = rtems_message_queue_urgent( Queue_id[ 2 ], (long (*)[4])buffer ); + directive_failed( status, "rtems_message_queue_urgent" ); + + puts( "TA1 - rtems_message_queue_delete - delete queue 2" ); + status = rtems_message_queue_delete( Queue_id[ 2 ] ); + directive_failed( status, "rtems_message_queue_delete" ); + + puts( "TA1 - rtems_message_queue_flush - empty Q 3" ); + status = rtems_message_queue_flush( Queue_id[ 3 ], &count ); + printf( "TA1 - %d messages were flushed from Q 3\n", count ); + + Fill_buffer( "BUFFER 1 TO Q 3", buffer ); + puts( "TA1 - rtems_message_queue_send - BUFFER 1 TO Q 3" ); + status = rtems_message_queue_send( Queue_id[ 3 ], (long (*)[4])buffer ); + directive_failed( status, "rtems_message_queue_send" ); + + Fill_buffer( "BUFFER 2 TO Q 3", buffer ); + puts( "TA1 - rtems_message_queue_send - BUFFER 2 TO Q 3" ); + status = rtems_message_queue_send( Queue_id[ 3 ], (long (*)[4])buffer ); + directive_failed( status, "rtems_message_queue_send" ); + + Fill_buffer( "BUFFER 3 TO Q 3", buffer ); + puts( "TA1 - rtems_message_queue_send - BUFFER 3 TO Q 3" ); + status = rtems_message_queue_send( Queue_id[ 3 ], (long (*)[4])buffer ); + directive_failed( status, "rtems_message_queue_send" ); + + puts( "TA1 - rtems_message_queue_flush - Q 3" ); + status = rtems_message_queue_flush( Queue_id[ 3 ], &count ); + printf( "TA1 - %d messages were flushed from Q 3\n", count ); + + puts( "TA1 - rtems_message_queue_send until all message buffers consumed" ); + while ( FOREVER ) { + status = rtems_message_queue_send( Queue_id[ 3 ], (long (*)[4])buffer ); + if ( status == RTEMS_UNSATISFIED ) break; + directive_failed( status, "rtems_message_queue_send loop" ); + } + + puts( "TA1 - all message buffers consumed" ); + puts( "TA1 - rtems_message_queue_flush - Q 3" ); + status = rtems_message_queue_flush( Queue_id[ 3 ], &count ); + printf( "TA1 - %d messages were flushed from Q 3\n", count ); + + if ( count != BSP_Configuration.maximum_messages ) + printf( "TA1 - ERROR - %d messages flushed!!!", count ); + + puts( "*** END OF TEST 13 ***" ); + exit( 0 ); +} diff --git a/c/src/tests/sptests/sp13/task2.c b/c/src/tests/sptests/sp13/task2.c new file mode 100644 index 0000000000..7d6438312c --- /dev/null +++ b/c/src/tests/sptests/sp13/task2.c @@ -0,0 +1,132 @@ +/* Task_2 + * + * This routine serves as a test task. Multiple tasks are required to + * verify all message manager capabilities. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_2( + rtems_task_argument argument +) +{ + long buffer[ 4 ]; + rtems_task_priority previous_priority; + rtems_status_code status; + + puts( + "TA2 - rtems_message_queue_receive - receive from queue 1 - RTEMS_NO_WAIT" + ); + status = rtems_message_queue_receive( + Queue_id[ 1 ], + (long (*)[4])buffer, + RTEMS_NO_WAIT, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_message_queue_receive" ); + puts_nocr( "TA2 - buffer received: " ); + Put_buffer( buffer ); + new_line; + + puts( + "TA2 - rtems_message_queue_receive - receive from queue 1 - " + "RTEMS_WAIT FOREVER" + ); + status = rtems_message_queue_receive( + Queue_id[ 1 ], + (long (*)[4])buffer, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_message_queue_receive" ); + puts_nocr( "TA2 - buffer received: " ); + Put_buffer( buffer ); + new_line; + + puts( + "TA2 - rtems_message_queue_receive - receive from queue 1 - " + "RTEMS_WAIT FOREVER" + ); + status = rtems_message_queue_receive( + Queue_id[ 1 ], + (long (*)[4])buffer, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_message_queue_receive" ); + puts_nocr( "TA2 - buffer received: " ); + Put_buffer( buffer ); + new_line; + + puts( "TA2 - rtems_task_set_priority - make self highest priority task" ); + status = rtems_task_set_priority( RTEMS_SELF, 3, &previous_priority ); + directive_failed( status, "rtems_task_set_priority" ); + + puts( + "TA2 - rtems_message_queue_receive - receive from queue 2 - " + "RTEMS_WAIT FOREVER" + ); + status = rtems_message_queue_receive( + Queue_id[ 2 ], + (long (*)[4])buffer, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_message_queue_receive" ); + puts_nocr( "TA2 - buffer received: " ); + Put_buffer( buffer ); + new_line; + + Fill_buffer( "BUFFER 2 TO Q 2", (long *)buffer ); + puts( "TA2 - rtems_message_queue_send - BUFFER 2 TO Q 2" ); + directive_failed( status, "rtems_message_queue_send" ); + + status = rtems_message_queue_send( Queue_id[ 2 ], (long (*)[4])buffer ); + directive_failed( status, "rtems_message_queue_send" ); + + puts( + "TA2 - rtems_message_queue_receive - receive from queue 1 - " + "10 second timeout" + ); + status = rtems_message_queue_receive( + Queue_id[ 1 ], + (long (*)[4])buffer, + RTEMS_DEFAULT_OPTIONS, + 10 * TICKS_PER_SECOND + ); + directive_failed( status, "rtems_message_queue_receive" ); + puts_nocr( "TA2 - buffer received: " ); + Put_buffer( buffer ); + new_line; + + puts( + "TA2 - rtems_message_queue_receive - receive from queue 3 - " + "RTEMS_WAIT FOREVER" + ); + status = rtems_message_queue_receive( + Queue_id[ 3 ], + (long (*)[4])buffer, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_message_queue_receive" ); + puts_nocr( "TA2 - buffer received: " ); + Put_buffer( buffer ); + new_line; + +} diff --git a/c/src/tests/sptests/sp13/task3.c b/c/src/tests/sptests/sp13/task3.c new file mode 100644 index 0000000000..3ba7b61728 --- /dev/null +++ b/c/src/tests/sptests/sp13/task3.c @@ -0,0 +1,74 @@ +/* Task_3 + * + * This routine serves as a test task. Its major function is to + * broadcast a messge to all the other tasks. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_3( + rtems_task_argument argument +) +{ + long buffer[ 4 ]; + rtems_unsigned32 count; + rtems_status_code status; + + puts( + "TA3 - rtems_message_queue_receive - receive from queue 2 - " + "RTEMS_WAIT FOREVER" + ); + status = rtems_message_queue_receive( + Queue_id[ 2 ], + (long (*)[4])buffer, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_message_queue_receive" ); + puts_nocr( "TA3 - buffer received: " ); + Put_buffer( buffer ); + new_line; + + Fill_buffer( "BUFFER 3 TO Q 1", (long *)buffer ); + puts( "TA3 - rtems_message_queue_broadcast - BUFFER 3 TO Q 1" ); + status = rtems_message_queue_broadcast( + Queue_id[ 1 ], + (long (*)[4])buffer, + &count + ); + printf( "TA3 - number of tasks awakened = %02d\n", count ); + puts( + "TA3 - rtems_message_queue_receive - receive from queue 3 - " + "RTEMS_WAIT FOREVER" + ); + + status = rtems_message_queue_receive( + Queue_id[ 3 ], + (long (*)[4])buffer, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT + ); + directive_failed( status, "rtems_message_queue_receive" ); + puts_nocr( "TA3 - buffer received: " ); + Put_buffer( buffer ); + new_line; + + puts( "TA3 - rtems_task_delete - delete self" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/c/src/tests/sptests/sp14/asr.c b/c/src/tests/sptests/sp14/asr.c new file mode 100644 index 0000000000..af7e212877 --- /dev/null +++ b/c/src/tests/sptests/sp14/asr.c @@ -0,0 +1,47 @@ +/* Process_asr + * + * This is the asynchronous signal routine (asr) for task 1. + * It demonstrates that ASRs can block execute and block. + * + * Input parameters: + * the_signal_set - signal set + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_asr Process_asr( + rtems_signal_set the_signal_set +) +{ + rtems_status_code status; + + printf( "ASR - ENTRY - signal => %08x\n", the_signal_set ); + switch( the_signal_set ) { + case RTEMS_SIGNAL_16: + case RTEMS_SIGNAL_17: + case RTEMS_SIGNAL_18 | RTEMS_SIGNAL_19: + break; + case RTEMS_SIGNAL_0: + case RTEMS_SIGNAL_1: + puts( "ASR - rtems_task_wake_after - yield processor" ); + status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + directive_failed( status, "rtems_task_wake_after yield" ); + break; + case RTEMS_SIGNAL_3: + Asr_fired = TRUE; + break; + } + printf( "ASR - EXIT - signal => %08x\n", the_signal_set ); +} diff --git a/c/src/tests/sptests/sp14/init.c b/c/src/tests/sptests/sp14/init.c new file mode 100644 index 0000000000..627295c03e --- /dev/null +++ b/c/src/tests/sptests/sp14/init.c @@ -0,0 +1,75 @@ +/* Init + * + * This routine is the initialization task for this test program. + * It is a user initialization task and has the responsibility for creating + * and starting the tasks that make up the test. If the time of day + * clock is required for the test, it should also be set to a known + * value by this function. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TEST 14 ***" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_create( + Task_name[ 2 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create of TA2" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_start( Task_id[ 2 ], Task_2, 0 ); + directive_failed( status, "rtems_task_start of TA2" ); + + Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' ); + + status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] ); + directive_failed( status, "rtems_timer_create of TM1" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/c/src/tests/sptests/sp14/sp14.doc b/c/src/tests/sptests/sp14/sp14.doc new file mode 100644 index 0000000000..16aa420183 --- /dev/null +++ b/c/src/tests/sptests/sp14/sp14.doc @@ -0,0 +1,24 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test14 + +directives: + ex_init, ex_start, t_create, t_start, t_delete, tm_tick, i_return, + as_catch, as_return, as_send, tm_wkafter + +concepts: + + a. This test checks out the signal manager. diff --git a/c/src/tests/sptests/sp14/sp14.scn b/c/src/tests/sptests/sp14/sp14.scn new file mode 100644 index 0000000000..31e6d067d2 --- /dev/null +++ b/c/src/tests/sptests/sp14/sp14.scn @@ -0,0 +1,33 @@ +*** TEST 14 *** +TA1 - rtems_signal_catch - RTEMS_INTERRUPT_LEVEL( 3 ) +TA1 - rtems_signal_send - RTEMS_SIGNAL_16 to self +ASR - ENTRY - signal => 00010000 +ASR - EXIT - signal => 00010000 +TA1 - rtems_signal_send - RTEMS_SIGNAL_0 to self +ASR - ENTRY - signal => 00000001 +ASR - rtems_task_wake_after - yield processor +TA2 - rtems_signal_send - RTEMS_SIGNAL_17 to TA1 +TA2 - rtems_task_wake_after - yield processor +ASR - ENTRY - signal => 00020000 +ASR - EXIT - signal => 00020000 +ASR - EXIT - signal => 00000001 +TA1 - rtems_signal_catch - RTEMS_NO_ASR + +TA1 - rtems_signal_send - RTEMS_SIGNAL_1 to self +ASR - ENTRY - signal => 00000002 +ASR - rtems_task_wake_after - yield processor +TA2 - rtems_signal_send - RTEMS_SIGNAL_18 and RTEMS_SIGNAL_19 to TA1 +TA2 - rtems_task_wake_after - yield processor +ASR - EXIT - signal => 00000002 +ASR - ENTRY - signal => 000c0000 +ASR - EXIT - signal => 000c0000 +TA1 - rtems_task_mode - disable ASRs +TA1 - sending signal to RTEMS_SELF from timer +TA1 - waiting for signal to arrive +TA1 - timer routine got the correct arguments +TA1 - rtems_task_mode - enable ASRs +ASR - ENTRY - signal => 00000008 +ASR - EXIT - signal => 00000008 +TA1 - rtems_signal_catch - asraddr of NULL +TA1 - rtems_task_delete - delete self +*** END OF TEST 14 *** diff --git a/c/src/tests/sptests/sp14/system.h b/c/src/tests/sptests/sp14/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/c/src/tests/sptests/sp14/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/c/src/tests/sptests/sp14/task1.c b/c/src/tests/sptests/sp14/task1.c new file mode 100644 index 0000000000..ac8feed71f --- /dev/null +++ b/c/src/tests/sptests/sp14/task1.c @@ -0,0 +1,116 @@ +/* Task_1 + * + * This routine serves as a test task. It establishes an RTEMS_ASR and + * sends signal to itself to determine if the RTEMS_ASR gets to execute. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_timer_service_routine Signal_3_to_task_1( + rtems_id id, + void *pointer +) +{ + rtems_status_code status; + + status = rtems_signal_send( Task_id[ 1 ], RTEMS_SIGNAL_3 ); + directive_failed( status, "rtems_signal_send of 3" ); + + Timer_got_this_id = id; + Timer_got_this_pointer = pointer; + + Signals_sent = TRUE; +} + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_mode previous_mode; + rtems_status_code status; + + puts( "TA1 - rtems_signal_catch - RTEMS_INTERRUPT_LEVEL( 3 )" ); + status = rtems_signal_catch( Process_asr, RTEMS_INTERRUPT_LEVEL(3) ); + directive_failed( status, "rtems_signal_catch" ); + + puts( "TA1 - rtems_signal_send - RTEMS_SIGNAL_16 to self" ); + status = rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_16 ); + directive_failed( status, "rtems_signal_send" ); + + puts( "TA1 - rtems_signal_send - RTEMS_SIGNAL_0 to self" ); + status = rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_0 ); + directive_failed( status, "rtems_signal_send" ); + + puts( "TA1 - rtems_signal_catch - RTEMS_NO_ASR" ); + status = rtems_signal_catch( Process_asr, RTEMS_NO_ASR ); + directive_failed( status, "rtems_signal_catch" ); + +pause(); + + puts( "TA1 - rtems_signal_send - RTEMS_SIGNAL_1 to self" ); + status = rtems_signal_send( RTEMS_SELF, RTEMS_SIGNAL_1 ); + directive_failed( status, "rtems_signal_send" ); + + puts( "TA1 - rtems_task_mode - disable ASRs" ); + status = rtems_task_mode( RTEMS_NO_ASR, RTEMS_ASR_MASK, &previous_mode ); + directive_failed( status, "rtems_task_mode" ); + + Timer_got_this_id = 0; + Timer_got_this_pointer = NULL; + + puts( "TA1 - sending signal to RTEMS_SELF from timer" ); + status = rtems_timer_fire_after( + Timer_id[ 1 ], + TICKS_PER_SECOND / 2, + Signal_3_to_task_1, + Task_1 + ); + directive_failed( status, "rtems_timer_fire_after" ); + + puts( "TA1 - waiting for signal to arrive" ); + + Signals_sent = FALSE; + Asr_fired = FALSE; + + while ( Signals_sent == FALSE ) + ; + + if ( Timer_got_this_id == Timer_id[ 1 ] && + Timer_got_this_pointer == Task_1 ) + puts( "TA1 - timer routine got the correct arguments" ); + else + printf( + "TA1 - timer got (0x%x, %p) instead of (0x%x, %p)!!!!\n", + Timer_got_this_id, + Timer_got_this_pointer, + Timer_id[ 1 ], + Task_1 + ); + + puts( "TA1 - rtems_task_mode - enable ASRs" ); + status = rtems_task_mode( RTEMS_ASR, RTEMS_ASR_MASK, &previous_mode ); + directive_failed( status, "rtems_task_mode" ); + + puts( "TA1 - rtems_signal_catch - asraddr of NULL" ); + status = rtems_signal_catch( NULL, RTEMS_DEFAULT_MODES ); + directive_failed( status, "rtems_signal_catch" ); + + puts( "TA1 - rtems_task_delete - delete self" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/c/src/tests/sptests/sp14/task2.c b/c/src/tests/sptests/sp14/task2.c new file mode 100644 index 0000000000..bf1e7cc224 --- /dev/null +++ b/c/src/tests/sptests/sp14/task2.c @@ -0,0 +1,48 @@ +/* Task_2 + * + * This routine serves as a test task. It verifies that one task can + * send signals to another task ( invoking the other task's RTEMS_ASR ). + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_2( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "TA2 - rtems_signal_send - RTEMS_SIGNAL_17 to TA1" ); + status = rtems_signal_send( Task_id[ 1 ], RTEMS_SIGNAL_17 ); + directive_failed( status, "rtems_signal_send" ); + + puts( "TA2 - rtems_task_wake_after - yield processor" ); + status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + directive_failed( status, "rtems_task_wake_after" ); + + puts("TA2 - rtems_signal_send - RTEMS_SIGNAL_18 and RTEMS_SIGNAL_19 to TA1"); + status = rtems_signal_send( Task_id[ 1 ], RTEMS_SIGNAL_18 | RTEMS_SIGNAL_19 ); + directive_failed( status, "rtems_signal_send" ); + + puts( "TA2 - rtems_task_wake_after - yield processor" ); + status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "*** END OF TEST 14 ***" ); + exit( 0 ); +} diff --git a/c/src/tests/sptests/sp15/init.c b/c/src/tests/sptests/sp15/init.c new file mode 100644 index 0000000000..4bee311714 --- /dev/null +++ b/c/src/tests/sptests/sp15/init.c @@ -0,0 +1,81 @@ +/* Init + * + * This routine is the initialization task for this test program. + * It is a user initialization task and has the responsibility for creating + * and starting the tasks that make up the test. If the time of day + * clock is required for the test, it should also be set to a known + * value by this function. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TEST 15 ***" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + + Partition_name[ 1 ] = rtems_build_name( 'P', 'T', '1', ' ' ); + Partition_name[ 2 ] = rtems_build_name( 'P', 'T', '2', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + 4, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + puts("INIT - rtems_partition_create - partition 1"); + status = rtems_partition_create( + Partition_name[ 1 ], + Area_1, + 4096, + 512, + RTEMS_DEFAULT_ATTRIBUTES, + &Partition_id[ 1 ] + ); + directive_failed( status, "rtems_partition_create of PT1" ); + + puts("INIT - rtems_partition_create - partition 2"); + status = rtems_partition_create( + Partition_name[ 2 ], + Area_2, + 274, + 128, + RTEMS_DEFAULT_ATTRIBUTES, + &Partition_id[ 2 ] + ); + directive_failed( status, "rtems_partition_create of PT2" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/c/src/tests/sptests/sp15/sp15.doc b/c/src/tests/sptests/sp15/sp15.doc new file mode 100644 index 0000000000..3ec20ae92b --- /dev/null +++ b/c/src/tests/sptests/sp15/sp15.doc @@ -0,0 +1,24 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test15 + +directives: + ex_init, ex_start, t_create, t_start, t_delete, tm_tick, i_return, + pt_create, pt_ident, pt_getbuf, pt_retbuf, pt_delete + +concepts: + + a. This test checks out the partition manager. diff --git a/c/src/tests/sptests/sp15/sp15.scn b/c/src/tests/sptests/sp15/sp15.scn new file mode 100644 index 0000000000..acddd5b5e9 --- /dev/null +++ b/c/src/tests/sptests/sp15/sp15.scn @@ -0,0 +1,16 @@ +*** TEST 15 *** +INIT - rtems_partition_create - partition 1 +INIT - rtems_partition_create - partition 2 +TA1 - rtems_partition_ident - partition 1 id = 00010001 +TA1 - rtems_partition_ident - partition 2 id = 00010002 +TA1 - rtems_partition_get_buffer - buffer 1 from partition 1 - 0x00000000 +TA1 - rtems_partition_get_buffer - buffer 2 from partition 1 - 0x00000200 +TA1 - rtems_partition_get_buffer - buffer 1 from partition 2 - 0x00000000 +TA1 - rtems_partition_get_buffer - buffer 2 from partition 2 - 0x00000080 +TA1 - rtems_partition_return_buffer - buffer 1 to partition 1 - 0x00000000 +TA1 - rtems_partition_return_buffer - buffer 2 to partition 1 - 0x00000200 +TA1 - rtems_partition_return_buffer - buffer 1 to partition 2 - 0x00000000 +TA1 - rtems_partition_return_buffer - buffer 2 to partition 2 - 0x00000080 +TA1 - rtems_partition_delete - delete partition 1 +TA1 - rtems_partition_delete - delete partition 2 +*** END OF TEST 15 *** diff --git a/c/src/tests/sptests/sp15/system.h b/c/src/tests/sptests/sp15/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/c/src/tests/sptests/sp15/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/c/src/tests/sptests/sp15/task1.c b/c/src/tests/sptests/sp15/task1.c new file mode 100644 index 0000000000..f22d27efe3 --- /dev/null +++ b/c/src/tests/sptests/sp15/task1.c @@ -0,0 +1,129 @@ +/* Task_1 + * + * This routine serves as a test task. It tests the partition manager. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_id ptid_1; + rtems_id ptid_2; + void *buffer_address_1; + void *buffer_address_2; + void *buffer_address_3; + void *buffer_address_4; + rtems_status_code status; + + puts_nocr( "TA1 - rtems_partition_ident - partition 1 id = " ); + status = rtems_partition_ident( + Partition_name[ 1 ], + RTEMS_SEARCH_ALL_NODES, + &ptid_1 + ); + directive_failed( status, "rtems_partition_ident of PT1" ); + printf( "%08x\n", ptid_1 ); + + puts_nocr( "TA1 - rtems_partition_ident - partition 2 id = " ); + status = rtems_partition_ident( + Partition_name[ 2 ], + RTEMS_SEARCH_ALL_NODES, + &ptid_2 + ); + directive_failed( status, "rtems_partition_ident of PT2" ); + printf( "%08x\n", ptid_2 ); + + puts_nocr( + "TA1 - rtems_partition_get_buffer - buffer 1 from partition 1 - " + ); + status = rtems_partition_get_buffer( ptid_1, &buffer_address_1 ); + directive_failed( status, "rtems_partition_get_buffer" ); + Put_address_from_area_1( buffer_address_1 ); + new_line; + + puts_nocr( + "TA1 - rtems_partition_get_buffer - buffer 2 from partition 1 - " + ); + status = rtems_partition_get_buffer( ptid_1, &buffer_address_2 ); + directive_failed( status, "rtems_partition_get_buffer" ); + Put_address_from_area_1( buffer_address_2 ); + new_line; + + puts_nocr( + "TA1 - rtems_partition_get_buffer - buffer 1 from partition 2 - " + ); + status = rtems_partition_get_buffer( ptid_2, &buffer_address_3 ); + directive_failed( status, "rtems_partition_get_buffer" ); + Put_address_from_area_2( buffer_address_3 ); + new_line; + + puts_nocr( + "TA1 - rtems_partition_get_buffer - buffer 2 from partition 2 - " + ); + status = rtems_partition_get_buffer( ptid_2, &buffer_address_4 ); + directive_failed( status, "rtems_partition_get_buffer" ); + Put_address_from_area_2( buffer_address_4 ); + new_line; + + puts_nocr( + "TA1 - rtems_partition_return_buffer - buffer 1 to partition 1 - " + ); + Put_address_from_area_1( buffer_address_1 ); + new_line; + status = rtems_partition_return_buffer( ptid_1, buffer_address_1 ); + directive_failed( status, "rtems_partition_return_buffer" ); + + puts_nocr( + "TA1 - rtems_partition_return_buffer - buffer 2 to partition 1 - " + ); + Put_address_from_area_1( buffer_address_2 ); + new_line; + status = rtems_partition_return_buffer( ptid_1, buffer_address_2 ); + directive_failed( status, "rtems_partition_return_buffer" ); + + puts_nocr( + "TA1 - rtems_partition_return_buffer - buffer 1 to partition 2 - " + ); + Put_address_from_area_2( buffer_address_3 ); + new_line; + status = rtems_partition_return_buffer( ptid_2, buffer_address_3 ); + directive_failed( status, "rtems_partition_return_buffer" ); + + puts_nocr( + "TA1 - rtems_partition_return_buffer - buffer 2 to partition 2 - " + ); + Put_address_from_area_2( buffer_address_4 ); + new_line; + status = rtems_partition_return_buffer( ptid_2, buffer_address_4 ); + directive_failed( status, "rtems_partition_return_buffer" ); + + puts( "TA1 - rtems_partition_delete - delete partition 1" + ); + status = rtems_partition_delete( ptid_1 ); + directive_failed( status, "rtems_partition_delete" ); + + puts( "TA1 - rtems_partition_delete - delete partition 2" + ); + status = rtems_partition_delete( ptid_2 ); + directive_failed( status, "rtems_partition_delete" ); + + puts( "*** END OF TEST 15 ***" ); + exit( 0 ); +} diff --git a/c/src/tests/sptests/sp16/init.c b/c/src/tests/sptests/sp16/init.c new file mode 100644 index 0000000000..a5b1163b13 --- /dev/null +++ b/c/src/tests/sptests/sp16/init.c @@ -0,0 +1,131 @@ +/* Init + * + * This routine is the initialization task for this test program. + * It is a user initialization task and has the responsibility for creating + * and starting the tasks that make up the test. If the time of day + * clock is required for the test, it should also be set to a known + * value by this function. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TEST 16 ***" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' ); + Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + BASE_PRIORITY, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_create( + Task_name[ 2 ], + BASE_PRIORITY, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create of TA2" ); + + status = rtems_task_create( + Task_name[ 3 ], + BASE_PRIORITY, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 3 ] + ); + directive_failed( status, "rtems_task_create of TA3" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_start( Task_id[ 2 ], Task_2, 0 ); + directive_failed( status, "rtems_task_start of TA2" ); + + status = rtems_task_start( Task_id[ 3 ], Task_3, 0 ); + directive_failed( status, "rtems_task_start of TA3" ); + + Region_name[ 1 ] = rtems_build_name( 'R', 'N', '1', ' ' ); + Region_name[ 2 ] = rtems_build_name( 'R', 'N', '2', ' ' ); + Region_name[ 3 ] = rtems_build_name( 'R', 'N', '3', ' ' ); + Region_name[ 4 ] = rtems_build_name( 'R', 'N', '4', ' ' ); + + status = rtems_region_create( + Region_name[ 1 ], + Area_1, + 4096, + 128, + RTEMS_DEFAULT_ATTRIBUTES, + &Region_id[ 1 ] + ); + directive_failed( status, "rtems_region_create of RN1" ); + + status = rtems_region_create( + Region_name[ 2 ], + Area_2, + 4096, + 128, + RTEMS_PRIORITY, + &Region_id[ 2 ] + ); + directive_failed( status, "rtems_region_create of RN2" ); + + status = rtems_region_create( + Region_name[ 3 ], + Area_3, + 4096, + 128, + RTEMS_DEFAULT_ATTRIBUTES, + &Region_id[ 3 ] + ); + directive_failed( status, "rtems_region_create of RN3" ); + + status = rtems_region_create( + Region_name[ 4 ], + Area_4, + 4096, + 128, + RTEMS_DEFAULT_ATTRIBUTES, + &Region_id[ 4 ] + ); + directive_failed( status, "rtems_region_create of RN4" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/c/src/tests/sptests/sp16/sp16.doc b/c/src/tests/sptests/sp16/sp16.doc new file mode 100644 index 0000000000..c5512af051 --- /dev/null +++ b/c/src/tests/sptests/sp16/sp16.doc @@ -0,0 +1,24 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test16 + +directives: + ex_init, ex_start, t_create, t_start, t_delete, tm_tick, i_return, + rn_create, rn_ident, rn_getbuf, rn_retbuf, rn_delete + +concepts: + + a. This test checks out the region manager. diff --git a/c/src/tests/sptests/sp16/sp16.scn b/c/src/tests/sptests/sp16/sp16.scn new file mode 100644 index 0000000000..a1a27cb9ad --- /dev/null +++ b/c/src/tests/sptests/sp16/sp16.scn @@ -0,0 +1,58 @@ +*** TEST 16 *** +TA1 - rtems_region_ident - rnid => 00010002 +TA1 - rtems_region_get_segment - wait on 100 byte segment from region 2 +TA1 - got segment from region 2 - 0x00000f78 +TA1 - rtems_region_get_segment - wait on 3K segment from region 3 +TA1 - got segment from region 3 - 0x000003f8 +TA1 - rtems_region_get_segment - get 3080 byte segment from region 1 - NO_WAIT +TA1 - got segment from region 1 - 0x00000378 +TA1 - rtems_task_wake_after - yield processor +TA2 - rtems_region_get_segment - wait on 2K segment from region 1 +TA3 - rtems_region_get_segment - wait on 3968 byte segment from region 2 + +TA1 - rtems_region_return_segment - return segment to region 1 - 0x00000378 +TA1 - rtems_region_get_segment - wait 10 seconds for 3K segment from region 1 +TA2 - got segment from region 1 - 0x000007f8 +TA2 - rtems_region_return_segment - return segment to region 1 - 0x000007f8 +TA2 - rtems_task_set_priority - make self highest priority task +TA2 - rtems_region_get_segment - wait on 3968 byte segment +TA1 - got segment from region 1 - 0x000003f8 +TA1 - rtems_region_return_segment - return segment to region 2 - 0x00000f78 +TA2 - got segment from region 2 - 0x00000008 +TA2 - rtems_region_return_segment - return segment to region 2 - 0x00000008 +TA2 - rtems_task_delete - delete self +TA1 - rtems_task_wake_after - yield processor +TA3 - got segment from region 2 - 0x00000008 +TA3 - rtems_region_get_segment - wait on 2K segment from region 3 +TA1 - rtems_task_delete - delete TA3 + +TA1 - rtems_task_wake_after - yield processor +TA4 - rtems_region_get_segment - wait on 1.5K segment from region 1 +TA5 - rtems_region_get_segment - wait on 1.5K segment from region 1 +TA1 - rtems_region_return_segment - return segment to region 1 - 0x000003f8 +TA1 - rtems_task_wake_after - yield processor +TA4 - got and returned 0x000009f8 +TA5 - got and returned 0x000003f0 +TA1 - rtems_region_get_segment - wait 10 seconds for 3K segment from region 1 +TA1 - got segment from region 1 - 0x000003f8 +TA1 - rtems_task_wake_after - yield processor +TA4 - rtems_region_get_segment - wait on 3K segment from region 1 +TA5 - rtems_region_get_segment - wait on 3K segment from region 1 +TA1 - rtems_task_delete - delete TA4 +TA1 - rtems_region_return_segment - return segment to region 1 - 0x000003f8 +TA1 - rtems_task_wake_after - yield processor +TA5 - got segment from region 1 - 0x000003f8 +TA5 - rtems_region_return_segment - return segment to region 1 - 0x000003f8 +TA5 - rtems_task_delete - delete self +TA1 - rtems_region_delete - delete region 1 +TA1 - rtems_region_get_segment - get 3K segment from region 4 +TA1 - got segment from region 4 - 0x000003f8 +TA1 - rtems_region_get_segment - attempt to get 3K segment from region 4 +TA1 - rtems_task_get_note - RTEMS_UNSATISFIED +TA1 - rtems_region_extend - extend region 4 by 4K +TA1 - rtems_region_get_segment - attempt to get 3K segment from region 4 +TA1 - got 3K segment from region 4 - 0x00001400 +TA1 - rtems_region_return_segment - return segment to region 4 - 0x000003f8 +TA1 - rtems_region_return_segment - return segment to region 4 - 0x00001400 +TA1 - rtems_region_delete - delete region 4 +*** END OF TEST 16 *** diff --git a/c/src/tests/sptests/sp16/system.h b/c/src/tests/sptests/sp16/system.h new file mode 100644 index 0000000000..9e2b748a85 --- /dev/null +++ b/c/src/tests/sptests/sp16/system.h @@ -0,0 +1,32 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +#define BASE_PRIORITY 140 /* all tasks priority */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/c/src/tests/sptests/sp16/task1.c b/c/src/tests/sptests/sp16/task1.c new file mode 100644 index 0000000000..25f90aca00 --- /dev/null +++ b/c/src/tests/sptests/sp16/task1.c @@ -0,0 +1,282 @@ +/* Task_1 + * + * This routine serves as a test task. It tests the region manager. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_id rnid; + void *segment_address_1; + void *segment_address_2; + void *segment_address_3; + void *segment_address_4; + rtems_status_code status; + + status = rtems_region_ident( Region_name[ 1 ], &rnid ); + printf( "TA1 - rtems_region_ident - rnid => %08x\n", rnid ); + directive_failed( status, "rtems_region_ident of RN1" ); + + puts( + "TA1 - rtems_region_get_segment - wait on 100 byte segment from region 2" + ); + status = rtems_region_get_segment( + Region_id[ 2 ], + 100, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &segment_address_1 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA1 - got segment from region 2 - " ); + Put_address_from_area_2( segment_address_1 ); + new_line; + + puts( "TA1 - rtems_region_get_segment - wait on 3K segment from region 3" ); + status = rtems_region_get_segment( + Region_id[ 3 ], + 3072, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &segment_address_2 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA1 - got segment from region 3 - " ); + Put_address_from_area_3( segment_address_2 ); + new_line; + + puts_nocr( "TA1 - rtems_region_get_segment - get 3080 byte segment " ); + puts ( "from region 1 - NO_WAIT" ); + status = rtems_region_get_segment( + Region_id[ 1 ], + 3080, + RTEMS_NO_WAIT, + RTEMS_NO_TIMEOUT, + &segment_address_3 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA1 - got segment from region 1 - " ); + Put_address_from_area_1( segment_address_3 ); + new_line; + + puts( "TA1 - rtems_task_wake_after - yield processor" ); + status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + directive_failed( status, "rtems_task_wake_after" ); + +pause(); + + puts_nocr( + "TA1 - rtems_region_return_segment - return segment to region 1 - " + ); + Put_address_from_area_1( segment_address_3 ); + status = rtems_region_return_segment( Region_id[ 1 ], segment_address_3 ); + directive_failed( status, "rtems_region_return_segment" ); + new_line; + + puts( + "TA1 - rtems_region_get_segment - wait 10 seconds for 3K " + "segment from region 1" + ); + status = rtems_region_get_segment( + Region_id[ 1 ], + 3072, + RTEMS_DEFAULT_OPTIONS, + 10 * TICKS_PER_SECOND, + &segment_address_4 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA1 - got segment from region 1 - " ); + Put_address_from_area_1( segment_address_4 ); + new_line; + + puts_nocr( + "TA1 - rtems_region_return_segment - return segment to region 2 - " + ); + Put_address_from_area_2( segment_address_1 ); + new_line; + status = rtems_region_return_segment( Region_id[ 2 ], segment_address_1 ); + directive_failed( status, "rtems_region_return_segment" ); + + puts( "TA1 - rtems_task_wake_after - yield processor" ); + status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "TA1 - rtems_task_delete - delete TA3" ); + status = rtems_task_delete( Task_id[ 3 ] ); + directive_failed( status, "rtems_task_delete of TA3" ); + +pause(); + + status = rtems_task_create( + Task_name[ 4 ], + BASE_PRIORITY, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 4 ] + ); + directive_failed( status, "rtems_task_create of TA4" ); + + status = rtems_task_create( + Task_name[ 5 ], + BASE_PRIORITY, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 5 ] + ); + directive_failed( status, "rtems_task_create of TA5" ); + + status = rtems_task_start( Task_id[ 4 ], Task_4, 0 ); + directive_failed( status, "rtems_task_start of TA4" ); + + status = rtems_task_start( Task_id[ 5 ], Task5, 0 ); + directive_failed( status, "rtems_task_start of TA5" ); + + puts( "TA1 - rtems_task_wake_after - yield processor" ); + status = rtems_task_wake_after( 1 * TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts_nocr( + "TA1 - rtems_region_return_segment - return segment to region 1 - " + ); + Put_address_from_area_1( segment_address_4 ); + status = rtems_region_return_segment( Region_id[ 1 ], segment_address_4 ); + directive_failed( status, "rtems_region_return_segment" ); + new_line; + + puts( "TA1 - rtems_task_wake_after - yield processor" ); + status = rtems_task_wake_after( 1 * TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts_nocr( "TA1 - rtems_region_get_segment - wait 10 seconds for 3K " ); + puts ( "segment from region 1"); + status = rtems_region_get_segment( + Region_id[ 1 ], + 3072, + RTEMS_DEFAULT_OPTIONS, + 10 * TICKS_PER_SECOND, + &segment_address_4 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA1 - got segment from region 1 - " ); + Put_address_from_area_1( segment_address_4 ); + new_line; + + puts( "TA1 - rtems_task_wake_after - yield processor" ); + status = rtems_task_wake_after( 1 * TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "TA1 - rtems_task_delete - delete TA4" ); + status = rtems_task_delete( Task_id[ 4 ] ); + directive_failed( status, "rtems_task_delete of TA4" ); + + puts_nocr( + "TA1 - rtems_region_return_segment - return segment to region 1 - " + ); + Put_address_from_area_1( segment_address_4 ); + status = rtems_region_return_segment( Region_id[ 1 ], segment_address_4 ); + directive_failed( status, "rtems_region_return_segment" ); + new_line; + + puts( "TA1 - rtems_task_wake_after - yield processor" ); + status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + + puts( "TA1 - rtems_region_delete - delete region 1" ); + status = rtems_region_delete( Region_id[ 1 ] ); + directive_failed( status, "rtems_region_delete" ); + + puts( "TA1 - rtems_region_get_segment - get 3K segment from region 4" ); + status = rtems_region_get_segment( + Region_id[ 4 ], + 3072, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &segment_address_1 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA1 - got segment from region 4 - " ); + Put_address_from_area_4( segment_address_1 ); + new_line; + + puts( + "TA1 - rtems_region_get_segment - attempt to get 3K segment from region 4" + ); + status = rtems_region_get_segment( + Region_id[ 4 ], + 3072, + RTEMS_NO_WAIT, + RTEMS_NO_TIMEOUT, + &segment_address_2 + ); + fatal_directive_status( + status, + RTEMS_UNSATISFIED, + "rtems_task_get_segment with no memory left" + ); + puts( "TA1 - rtems_task_get_note - RTEMS_UNSATISFIED" ); + + puts( "TA1 - rtems_region_extend - extend region 4 by 4K" ); + status = rtems_region_extend( + Region_id[ 4 ], + &Area_4[4096], + 4096 + ); + directive_failed( status, "rtems_region_extend" ); + + puts( + "TA1 - rtems_region_get_segment - attempt to get 3K segment from region 4" + ); + status = rtems_region_get_segment( + Region_id[ 4 ], + 3072, + RTEMS_NO_WAIT, + RTEMS_NO_TIMEOUT, + &segment_address_3 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA1 - got 3K segment from region 4 - " ); + Put_address_from_area_4( segment_address_3 ); + new_line; + + puts_nocr( + "TA1 - rtems_region_return_segment - return segment to region 4 - " + ); + Put_address_from_area_4( segment_address_1 ); + status = rtems_region_return_segment( Region_id[ 4 ], segment_address_1 ); + directive_failed( status, "rtems_region_return_segment" ); + new_line; + + puts_nocr( + "TA1 - rtems_region_return_segment - return segment to region 4 - " + ); + Put_address_from_area_4( segment_address_3 ); + status = rtems_region_return_segment( Region_id[ 4 ], segment_address_3 ); + directive_failed( status, "rtems_region_return_segment" ); + new_line; + + puts( "TA1 - rtems_region_delete - delete region 4" ); + status = rtems_region_delete( Region_id[ 4 ] ); + directive_failed( status, "rtems_region_delete" ); + + puts( "*** END OF TEST 16 ***" ); + exit( 0 ); +} diff --git a/c/src/tests/sptests/sp16/task2.c b/c/src/tests/sptests/sp16/task2.c new file mode 100644 index 0000000000..d5bc312b27 --- /dev/null +++ b/c/src/tests/sptests/sp16/task2.c @@ -0,0 +1,86 @@ +/* Task_2 + * + * This routine serves as a test task. It competes with the other tasks + * for region resources. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_2( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_task_priority previous_priority; + void *segment_address_1; + void *segment_address_2; + + puts( "TA2 - rtems_region_get_segment - wait on 2K segment from region 1" ); + status = rtems_region_get_segment( + Region_id[ 1 ], + 2048, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &segment_address_1 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA2 - got segment from region 1 - " ); + Put_address_from_area_1( segment_address_1 ); + new_line; + + puts_nocr( + "TA2 - rtems_region_return_segment - return segment to region 1 - " + ); + Put_address_from_area_1( segment_address_1 ); + status = rtems_region_return_segment( Region_id[ 1 ], segment_address_1 ); + directive_failed( status, "rtems_region_return_segment" ); + new_line; + + puts( "TA2 - rtems_task_set_priority - make self highest priority task" ); + status = rtems_task_set_priority( + RTEMS_SELF, + BASE_PRIORITY-1, + &previous_priority + ); + directive_failed( status, "rtems_task_set_priority" ); + + puts("TA2 - rtems_region_get_segment - wait on 3968 byte segment"); + status = rtems_region_get_segment( + Region_id[ 2 ], + 3968, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &segment_address_2 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA2 - got segment from region 2 - "); + Put_address_from_area_2( segment_address_2 ); + new_line; + + puts_nocr( + "TA2 - rtems_region_return_segment - return segment to region 2 - " + ); + Put_address_from_area_2( segment_address_2 ); + status = rtems_region_return_segment( Region_id[ 2 ], segment_address_2 ); + directive_failed( status, "rtems_region_return_segment" ); + new_line; + + puts( "TA2 - rtems_task_delete - delete self" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/c/src/tests/sptests/sp16/task3.c b/c/src/tests/sptests/sp16/task3.c new file mode 100644 index 0000000000..292e5824f6 --- /dev/null +++ b/c/src/tests/sptests/sp16/task3.c @@ -0,0 +1,57 @@ +/* Task_3 + * + * This routine serves as a test task. It competes with the other tasks + * for region resources. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_3( + rtems_task_argument argument +) +{ + rtems_status_code status; + void *segment_address_1; + void *segment_address_2; + + puts( + "TA3 - rtems_region_get_segment - wait on 3968 byte segment from region 2" + ); + status = rtems_region_get_segment( + Region_id[ 2 ], + 3968, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &segment_address_1 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA3 - got segment from region 2 - " ); + Put_address_from_area_2( segment_address_1 ); + new_line; + directive_failed( status, "rtems_region_return_segment" ); + + puts( "TA3 - rtems_region_get_segment - wait on 2K segment from region 3" ); + status = rtems_region_get_segment( + Region_id[ 3 ], + 2048, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &segment_address_2 + ); + directive_failed( status, "rtems_region_get_segment" ); +} diff --git a/c/src/tests/sptests/sp16/task4.c b/c/src/tests/sptests/sp16/task4.c new file mode 100644 index 0000000000..f3da89b72e --- /dev/null +++ b/c/src/tests/sptests/sp16/task4.c @@ -0,0 +1,60 @@ +/* Task_4 + * + * This routine serves as a test task. It competes with the other tasks + * for region resources. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_4( + rtems_task_argument argument +) +{ + rtems_status_code status; + void *segment_address_1; + void *segment_address_2; + + puts( "TA4 - rtems_region_get_segment - wait on 1.5K segment from region 1" ); + status = rtems_region_get_segment( + Region_id[ 1 ], + 1536, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &segment_address_1 + ); + directive_failed( status, "rtems_region_get_segment" ); + + status = rtems_region_return_segment( Region_id[ 1 ], segment_address_1 ); + directive_failed( status, "rtems_region_return_segment" ); + puts_nocr( "TA4 - got and returned " ); + Put_address_from_area_1( segment_address_1 ); + new_line; + + status = rtems_task_wake_after( TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "TA4 - rtems_region_get_segment - wait on 3K segment from region 1" ); + status = rtems_region_get_segment( + Region_id[ 1 ], + 3072, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &segment_address_2 + ); + directive_failed( status, "rtems_region_get_segment" ); +} diff --git a/c/src/tests/sptests/sp16/task5.c b/c/src/tests/sptests/sp16/task5.c new file mode 100644 index 0000000000..5defa75f9c --- /dev/null +++ b/c/src/tests/sptests/sp16/task5.c @@ -0,0 +1,73 @@ +/* Task5 + * + * This routine serves as a test task. It competes with the other tasks + * for region resources. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task5( + rtems_task_argument argument +) +{ + void *segment_address_1; + void *segment_address_2; + rtems_status_code status; + + puts( "TA5 - rtems_region_get_segment - wait on 1.5K segment from region 1" ); + status = rtems_region_get_segment( + Region_id[ 1 ], + 1536, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &segment_address_1 + ); + directive_failed( status, "rtems_region_get_segment" ); + + status = rtems_region_return_segment( Region_id[ 1 ], segment_address_1 ); + directive_failed( status, "rtems_region_return_segment" ); + puts_nocr( "TA5 - got and returned " ); + Put_address_from_area_1( segment_address_1 ); + new_line; + + status = rtems_task_wake_after( TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "TA5 - rtems_region_get_segment - wait on 3K segment from region 1" ); + status = rtems_region_get_segment( + Region_id[ 1 ], + 3072, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &segment_address_2 + ); + puts_nocr( "TA5 - got segment from region 1 - " ); + Put_address_from_area_1( segment_address_2 ); + new_line; + + status = rtems_region_return_segment( Region_id[ 1 ], segment_address_2 ); + puts_nocr( + "TA5 - rtems_region_return_segment - return segment to region 1 - " + ); + Put_address_from_area_1( segment_address_2 ); + new_line; + + puts( "TA5 - rtems_task_delete - delete self" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/c/src/tests/sptests/sp17/asr.c b/c/src/tests/sptests/sp17/asr.c new file mode 100644 index 0000000000..1795bbd522 --- /dev/null +++ b/c/src/tests/sptests/sp17/asr.c @@ -0,0 +1,32 @@ +/* Process_asr + * + * This routine performs the processing for task 1's RTEMS_ASR. It is called + * by an assembly routine which saves the necessary registers. + * + * Input parameters: + * signal - signal set + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_asr Process_asr( + rtems_signal_set signal_set +) +{ + rtems_status_code status; + + status = rtems_task_resume( Task_id[ 2 ] ); + directive_failed( status, "RTEMS_ASR - rtems_task_resume of TA2" ); +} diff --git a/c/src/tests/sptests/sp17/init.c b/c/src/tests/sptests/sp17/init.c new file mode 100644 index 0000000000..5527e80c9c --- /dev/null +++ b/c/src/tests/sptests/sp17/init.c @@ -0,0 +1,72 @@ +/* Init + * + * This routine is the initialization task for this test program. + * It is a user initialization task and has the responsibility for creating + * and starting the tasks that make up the test. If the time of day + * clock is required for the test, it should also be set to a known + * value by this function. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TEST 17 ***" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + + Task_2_preempted = FALSE; + + status = rtems_task_create( + Task_name[ 1 ], + 2, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_create( + Task_name[ 2 ], + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create of TA2" ); + + status = rtems_task_start( Task_id[ 2 ], Task_2, 0 ); + directive_failed( status, "rtems_task_start of TA2" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/c/src/tests/sptests/sp17/sp17.doc b/c/src/tests/sptests/sp17/sp17.doc new file mode 100644 index 0000000000..b4258461cf --- /dev/null +++ b/c/src/tests/sptests/sp17/sp17.doc @@ -0,0 +1,35 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test17 + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident, + as_catch, as_return + +concepts: + + a. Verifies system can create and start both the executive's system + initialization and idle task. + + b. Verifies can print strings to the CRT on port 2 of the mvme136 board + using Print and Println in the board support package. + + c. Verifies executive initialization performed correctly. + + d. Verifies that a task can get the task identification number + of another task. + + e. Verifies that a signal can be sent to a remote task. diff --git a/c/src/tests/sptests/sp17/sp17.scn b/c/src/tests/sptests/sp17/sp17.scn new file mode 100644 index 0000000000..47fd140e2a --- /dev/null +++ b/c/src/tests/sptests/sp17/sp17.scn @@ -0,0 +1,8 @@ +*** TEST 17 *** +TA2 - Suspending self +TA1 - rtems_signal_catch: initializing signal catcher +TA1 - Sending signal to self +TA2 - signal_return preempted correctly +TA1 - TA2 correctly preempted me +TA1 - Got Back!!! +*** END OF TEST 17 *** diff --git a/c/src/tests/sptests/sp17/system.h b/c/src/tests/sptests/sp17/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/c/src/tests/sptests/sp17/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/c/src/tests/sptests/sp17/task1.c b/c/src/tests/sptests/sp17/task1.c new file mode 100644 index 0000000000..282c161a39 --- /dev/null +++ b/c/src/tests/sptests/sp17/task1.c @@ -0,0 +1,48 @@ +/* Task_1 + * + * This task initializes the signal catcher, sends the first signal + * if running on the first node, and loops while waiting for signals. + * + * NOTE: The signal catcher is not reentrant and hence RTEMS_NO_ASR must + * be a part of its execution mode. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "TA1 - rtems_signal_catch: initializing signal catcher" ); + status = rtems_signal_catch( Process_asr, RTEMS_NO_ASR | RTEMS_NO_PREEMPT ); + directive_failed( status, "rtems_signal_catch" ); + + puts( "TA1 - Sending signal to self" ); + status = rtems_signal_send( Task_id[ 1 ], RTEMS_SIGNAL_16 ); + directive_failed( status, "rtems_signal_send" ); + + if ( Task_2_preempted == TRUE ) + puts( "TA1 - TA2 correctly preempted me" ); + + puts("TA1 - Got Back!!!"); + + puts( "*** END OF TEST 17 ***" ); + exit( 0 ); +} diff --git a/c/src/tests/sptests/sp17/task2.c b/c/src/tests/sptests/sp17/task2.c new file mode 100644 index 0000000000..cd3e16c7c0 --- /dev/null +++ b/c/src/tests/sptests/sp17/task2.c @@ -0,0 +1,45 @@ +/* Task_2 + * + * This task initializes the signal catcher, sends the first signal + * if running on the first node, and loops while waiting for signals. + * + * NOTE: The signal catcher is not reentrant and hence RTEMS_NO_ASR must + * be a part of its execution mode. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_2( + rtems_task_argument argument +) +{ + rtems_status_code status; + + Task_2_preempted = FALSE; + + puts( "TA2 - Suspending self" ); + status = rtems_task_suspend( RTEMS_SELF ); + directive_failed( status, "rtems_task_suspend of TA2" ); + + puts( "TA2 - signal_return preempted correctly" ); + + Task_2_preempted = TRUE; + + status = rtems_task_suspend( RTEMS_SELF ); + directive_failed( status, "rtems_task_suspend of TA2" ); +} diff --git a/c/src/tests/sptests/sp19/first.c b/c/src/tests/sptests/sp19/first.c new file mode 100644 index 0000000000..94bdedd5ad --- /dev/null +++ b/c/src/tests/sptests/sp19/first.c @@ -0,0 +1,66 @@ +/* First_FP_task + * + * This routine serves as a floating point test task. It verifies the + * basic task switching capabilities of the executive when floating + * point is configured. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#include "fptest.h" +#include "inttest.h" + +rtems_task First_FP_task( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_id tid; + rtems_time_of_day time; + rtems_unsigned32 task_index; + INTEGER_DECLARE; + FP_DECLARE; + + status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid ); + directive_failed( status, "rtems_task_ident" ); + + task_index = task_number( tid ); + + INTEGER_LOAD( INTEGER_factors[ task_index ] ); + FP_LOAD( FP_factors[ task_index ] ); + + put_name( Task_name[ task_index ], FALSE ); + printf( " - integer base = (0x%x)\n", INTEGER_factors[ task_index ] ); + put_name( Task_name[ task_index ], FALSE ); +#if ( RTEMS_HAS_HARDWARE_FP == 1 ) + printf( " - float base = (%g)\n", FP_factors[ task_index ] ); +#else + printf( " - float base = (NA)\n" ); +#endif + + if ( argument == 0 ) { + status = rtems_task_restart( RTEMS_SELF, 1 ); + directive_failed( status, "rtems_task_restart of RTEMS_SELF" ); + } else { + build_time( &time, 12, 31, 1988, 9, 0, 0, 0 ); + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); + } +} diff --git a/c/src/tests/sptests/sp19/fptask.c b/c/src/tests/sptests/sp19/fptask.c new file mode 100644 index 0000000000..b8e881e6cd --- /dev/null +++ b/c/src/tests/sptests/sp19/fptask.c @@ -0,0 +1,98 @@ +/* FP_task + * + * This routine serves as a floating point test task. It verifies the + * basic task switching capabilities of the executive when floating + * point is configured. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#include "fptest.h" +#include "inttest.h" + +rtems_task FP_task( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_id tid; + rtems_time_of_day time; + rtems_unsigned32 task_index; + rtems_unsigned32 previous_seconds; + INTEGER_DECLARE; + FP_DECLARE; + + status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid ); + directive_failed( status, "rtems_task_ident of self" ); + + task_index = task_number( tid ); + + INTEGER_LOAD( INTEGER_factors[ task_index ] ); + FP_LOAD( FP_factors[ task_index ] ); + + put_name( Task_name[ task_index ], FALSE ); + printf( " - integer base = (0x%x)\n", INTEGER_factors[ task_index ] ); + put_name( Task_name[ task_index ], FALSE ); +#if ( RTEMS_HAS_HARDWARE_FP == 1 ) + printf( " - float base = (%g)\n", FP_factors[ task_index ] ); +#else + printf( " - float base = (NA)\n" ); +#endif + + previous_seconds = -1; + + while( FOREVER ) { + + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_get" ); + + if ( time.second >= 16 ) { + + if ( task_number( tid ) == 4 ) { + puts( "TA4 - rtems_task_delete - self" ); + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of TA4" ); + } + puts( "TA5 - rtems_task_delete - TA3" ); + status = rtems_task_delete( Task_id[ 3 ] ); + directive_failed( status, "rtems_task_delete of TA3" ); + + puts( "*** END OF TEST 19 *** " ); + exit( 0 ); + } + + if (previous_seconds != time.second) + { + put_name( Task_name[ task_index ], FALSE ); + print_time( " - rtems_clock_get - ", &time, "\n" ); + previous_seconds = time.second; + } + + INTEGER_CHECK( INTEGER_factors[ task_index ] ); + FP_CHECK( FP_factors[ task_index ] ); + + /* for the first 4 seconds we spin as fast as possible + * so that we likely are interrupted + * After that, we go to sleep for a second at a time + */ + if (time.second >= 4) + { + status = rtems_task_wake_after( TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + } + } +} diff --git a/c/src/tests/sptests/sp19/fptest.h b/c/src/tests/sptests/sp19/fptest.h new file mode 100644 index 0000000000..a8f3a925cb --- /dev/null +++ b/c/src/tests/sptests/sp19/fptest.h @@ -0,0 +1,165 @@ +/* fptest.h + * + * This include file contains the CPU dependent implementation + * of the following routines needed to test RTEMS floating + * point support: + * FP_load( &context ) + * FP_check( &context ) + * + * FP_load - loads the specified floating point context + * FP_check - checks the specified floating point context + * + * NOTE: These routines are VERY CPU dependent and are thus + * located in in the CPU dependent include file + * fptest.h. These routines form the core of the + * floating point context switch test. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +#ifndef __FPTEST_h +#define __FPTEST_h + +#include + +#ifndef RTEMS_HAS_HARDWARE_FP +#error "This CPU does not have RTEMS_HAS_HARDWARE_FP defined" +#endif + +#if ( RTEMS_HAS_HARDWARE_FP == FALSE ) + +#define FP_DECLARE ; +#define FP_LOAD( _factor ) +#define FP_CHECK( _factor ) 0 + +#else + +#define FP_DECLARE \ + double fp01 = 1.0; \ + double fp02 = 2.0; \ + double fp03 = 3.0; \ + double fp04 = 4.0; \ + double fp05 = 5.0; \ + double fp06 = 6.0; \ + double fp07 = 7.0; \ + double fp08 = 8.0; \ + double fp09 = 9.0; \ + double fp10 = 10.0; \ + double fp11 = 11.0; \ + double fp12 = 12.0; \ + double fp13 = 13.0; \ + double fp14 = 14.0; \ + double fp15 = 15.0; \ + double fp16 = 16.0; \ + double fp17 = 17.0; \ + double fp18 = 18.0; \ + double fp19 = 19.0; \ + double fp20 = 20.0; \ + double fp21 = 21.0; \ + double fp22 = 22.0; \ + double fp23 = 23.0; \ + double fp24 = 24.0; \ + double fp25 = 25.0; \ + double fp26 = 26.0; \ + double fp27 = 27.0; \ + double fp28 = 28.0; \ + double fp29 = 29.0; \ + double fp30 = 30.0; \ + double fp31 = 31.0; \ + double fp32 = 32.0 + +#define FP_LOAD( _factor ) \ + do { \ + fp01 += _factor; \ + fp02 += _factor; \ + fp03 += _factor; \ + fp04 += _factor; \ + fp05 += _factor; \ + fp06 += _factor; \ + fp07 += _factor; \ + fp08 += _factor; \ + fp09 += _factor; \ + fp10 += _factor; \ + fp11 += _factor; \ + fp12 += _factor; \ + fp13 += _factor; \ + fp14 += _factor; \ + fp15 += _factor; \ + fp16 += _factor; \ + fp17 += _factor; \ + fp18 += _factor; \ + fp19 += _factor; \ + fp20 += _factor; \ + fp21 += _factor; \ + fp22 += _factor; \ + fp23 += _factor; \ + fp24 += _factor; \ + fp25 += _factor; \ + fp26 += _factor; \ + fp27 += _factor; \ + fp28 += _factor; \ + fp29 += _factor; \ + fp30 += _factor; \ + fp31 += _factor; \ + fp32 += _factor; \ + } while (0) + +#define EPSILON (0.0005) +#define FPABS(d) (((d) < 0.0) ? -(d) : (d)) +#define FPNEQ(a,b) (FPABS((a)-(b)) > EPSILON) + +#define FP_CHECK_ONE( _v, _base, _factor ) \ + if ( FPNEQ( (_v), ((_base) + (_factor)) ) ) { \ + printf("%d: " #_v " wrong -- (%g not %g)\n", \ + task_index, (_v), (_base + _factor)); \ + } + + +#define FP_CHECK( _factor ) \ + do { \ + FP_CHECK_ONE( fp01, 1.0, (_factor) ); \ + FP_CHECK_ONE( fp02, 2.0, (_factor) ); \ + FP_CHECK_ONE( fp03, 3.0, (_factor) ); \ + FP_CHECK_ONE( fp04, 4.0, (_factor) ); \ + FP_CHECK_ONE( fp05, 5.0, (_factor) ); \ + FP_CHECK_ONE( fp06, 6.0, (_factor) ); \ + FP_CHECK_ONE( fp07, 7.0, (_factor) ); \ + FP_CHECK_ONE( fp08, 8.0, (_factor) ); \ + FP_CHECK_ONE( fp09, 9.0, (_factor) ); \ + FP_CHECK_ONE( fp10, 10.0, (_factor) ); \ + FP_CHECK_ONE( fp11, 11.0, (_factor) ); \ + FP_CHECK_ONE( fp12, 12.0, (_factor) ); \ + FP_CHECK_ONE( fp13, 13.0, (_factor) ); \ + FP_CHECK_ONE( fp14, 14.0, (_factor) ); \ + FP_CHECK_ONE( fp15, 15.0, (_factor) ); \ + FP_CHECK_ONE( fp16, 16.0, (_factor) ); \ + FP_CHECK_ONE( fp17, 17.0, (_factor) ); \ + FP_CHECK_ONE( fp18, 18.0, (_factor) ); \ + FP_CHECK_ONE( fp19, 19.0, (_factor) ); \ + FP_CHECK_ONE( fp20, 20.0, (_factor) ); \ + FP_CHECK_ONE( fp21, 21.0, (_factor) ); \ + FP_CHECK_ONE( fp22, 22.0, (_factor) ); \ + FP_CHECK_ONE( fp23, 23.0, (_factor) ); \ + FP_CHECK_ONE( fp24, 24.0, (_factor) ); \ + FP_CHECK_ONE( fp25, 25.0, (_factor) ); \ + FP_CHECK_ONE( fp26, 26.0, (_factor) ); \ + FP_CHECK_ONE( fp27, 27.0, (_factor) ); \ + FP_CHECK_ONE( fp28, 28.0, (_factor) ); \ + FP_CHECK_ONE( fp29, 29.0, (_factor) ); \ + FP_CHECK_ONE( fp30, 30.0, (_factor) ); \ + FP_CHECK_ONE( fp31, 31.0, (_factor) ); \ + FP_CHECK_ONE( fp32, 32.0, (_factor) ); \ + } while (0) + +#endif + +#endif diff --git a/c/src/tests/sptests/sp19/init.c b/c/src/tests/sptests/sp19/init.c new file mode 100644 index 0000000000..477ec4ef43 --- /dev/null +++ b/c/src/tests/sptests/sp19/init.c @@ -0,0 +1,153 @@ +/* Init + * + * This routine is the initialization task for this test program. + * It is a user initialization task and has the responsibility for creating + * and starting the tasks that make up the test. If the time of day + * clock is required for the test, it should also be set to a known + * value by this function. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TEST 19 ***" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' ); + Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' ); + Task_name[ 6 ] = rtems_build_name( 'F', 'P', '1', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + 2, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_FLOATING_POINT, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_create( + Task_name[ 2 ], + 2, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 2 ] + ); + directive_failed( status, "rtems_task_create of TA2" ); + + status = rtems_task_create( + Task_name[ 3 ], + 2, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 3 ] + ); + directive_failed( status, "rtems_task_create of TA3" ); + + status = rtems_task_create( + Task_name[ 4 ], + 2, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_FLOATING_POINT, + &Task_id[ 4 ] + ); + directive_failed( status, "rtems_task_create of TA4" ); + + status = rtems_task_create( + Task_name[ 5 ], + 2, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_FLOATING_POINT, + &Task_id[ 5 ] + ); + directive_failed( status, "rtems_task_create of TA5" ); + + status = rtems_task_create( + Task_name[ 6 ], + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_FLOATING_POINT, + &Task_id[ 6 ] + ); + directive_failed( status, "rtems_task_create of FP1" ); + + status = rtems_task_start( Task_id[ 6 ], First_FP_task, 0 ); + directive_failed( status, "rtems_task_start of FP1" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_start( Task_id[ 2 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA2" ); + + status = rtems_task_start( Task_id[ 3 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA3" ); + + status = rtems_task_start( Task_id[ 4 ], FP_task, 0 ); + directive_failed( status, "rtems_task_start of TA4" ); + + status = rtems_task_start( Task_id[ 5 ], FP_task, 0 ); + directive_failed( status, "rtems_task_create of TA5" ); + + /* + * Load "task dependent factors" in the context areas + */ + + + FP_factors[0] = 0.0; + FP_factors[1] = 1000.1; + FP_factors[2] = 2000.2; + FP_factors[3] = 3000.3; + FP_factors[4] = 4000.4; + FP_factors[5] = 5000.5; + FP_factors[6] = 6000.6; + FP_factors[7] = 7000.7; + FP_factors[8] = 8000.8; + FP_factors[9] = 9000.9; + + INTEGER_factors[0] = 0x0000; + INTEGER_factors[1] = 0x1000; + INTEGER_factors[2] = 0x2000; + INTEGER_factors[3] = 0x3000; + INTEGER_factors[4] = 0x4000; + INTEGER_factors[5] = 0x5000; + INTEGER_factors[6] = 0x6000; + INTEGER_factors[7] = 0x7000; + INTEGER_factors[8] = 0x8000; + INTEGER_factors[9] = 0x9000; + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of TA1" ); +} diff --git a/c/src/tests/sptests/sp19/inttest.h b/c/src/tests/sptests/sp19/inttest.h new file mode 100644 index 0000000000..5dfb0af636 --- /dev/null +++ b/c/src/tests/sptests/sp19/inttest.h @@ -0,0 +1,149 @@ +/* inttest.h + * + * XXX: ??? + * This include file contains the CPU dependent implementation + * of the following routines needed to test RTEMS floating + * point support: + * INTEGER_load( &context ) + * INTEGER_check( &context ) + * + * INTEGER_load - loads the specified floating point context + * INTEGER_check - checks the specified floating point context + * + * NOTE: These routines are VERY CPU dependent and are thus + * located in in the CPU dependent include file + * inttest.h. These routines form the core of the + * floating point context switch test. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + + +#ifndef __INTEGER_TEST_h +#define __INTEGER_TEST_h + +#include +#define REG_VARIABLE rtems_unsigned32 + +#define INTEGER_DECLARE \ + REG_VARIABLE int01 = 1; \ + REG_VARIABLE int02 = 2; \ + REG_VARIABLE int03 = 3; \ + REG_VARIABLE int04 = 4; \ + REG_VARIABLE int05 = 5; \ + REG_VARIABLE int06 = 6; \ + REG_VARIABLE int07 = 7; \ + REG_VARIABLE int08 = 8; \ + REG_VARIABLE int09 = 9; \ + REG_VARIABLE int10 = 10; \ + REG_VARIABLE int11 = 11; \ + REG_VARIABLE int12 = 12; \ + REG_VARIABLE int13 = 13; \ + REG_VARIABLE int14 = 14; \ + REG_VARIABLE int15 = 15; \ + REG_VARIABLE int16 = 16; \ + REG_VARIABLE int17 = 17; \ + REG_VARIABLE int18 = 18; \ + REG_VARIABLE int19 = 19; \ + REG_VARIABLE int20 = 20; \ + REG_VARIABLE int21 = 21; \ + REG_VARIABLE int22 = 22; \ + REG_VARIABLE int23 = 23; \ + REG_VARIABLE int24 = 24; \ + REG_VARIABLE int25 = 25; \ + REG_VARIABLE int26 = 26; \ + REG_VARIABLE int27 = 27; \ + REG_VARIABLE int28 = 28; \ + REG_VARIABLE int29 = 29; \ + REG_VARIABLE int30 = 30; \ + REG_VARIABLE int31 = 31; \ + REG_VARIABLE int32 = 32 + +#define INTEGER_LOAD( _factor ) \ + do { \ + int01 += _factor; \ + int02 += _factor; \ + int03 += _factor; \ + int04 += _factor; \ + int05 += _factor; \ + int06 += _factor; \ + int07 += _factor; \ + int08 += _factor; \ + int09 += _factor; \ + int10 += _factor; \ + int11 += _factor; \ + int12 += _factor; \ + int13 += _factor; \ + int14 += _factor; \ + int15 += _factor; \ + int16 += _factor; \ + int17 += _factor; \ + int18 += _factor; \ + int19 += _factor; \ + int20 += _factor; \ + int21 += _factor; \ + int22 += _factor; \ + int23 += _factor; \ + int24 += _factor; \ + int25 += _factor; \ + int26 += _factor; \ + int27 += _factor; \ + int28 += _factor; \ + int29 += _factor; \ + int30 += _factor; \ + int31 += _factor; \ + int32 += _factor; \ + } while (0) + +#define INTEGER_CHECK_ONE( _v, _base, _factor ) \ + if ( (_v) != ((_base) + (_factor)) ) { \ + printf("%d: " #_v " wrong -- (0x%x not 0x%x)\n", \ + task_index, (_v), (_base + _factor)); \ + } + + +#define INTEGER_CHECK( _factor ) \ + do { \ + INTEGER_CHECK_ONE( int01, 1, (_factor) ); \ + INTEGER_CHECK_ONE( int02, 2, (_factor) ); \ + INTEGER_CHECK_ONE( int03, 3, (_factor) ); \ + INTEGER_CHECK_ONE( int04, 4, (_factor) ); \ + INTEGER_CHECK_ONE( int05, 5, (_factor) ); \ + INTEGER_CHECK_ONE( int06, 6, (_factor) ); \ + INTEGER_CHECK_ONE( int07, 7, (_factor) ); \ + INTEGER_CHECK_ONE( int08, 8, (_factor) ); \ + INTEGER_CHECK_ONE( int09, 9, (_factor) ); \ + INTEGER_CHECK_ONE( int10, 10, (_factor) ); \ + INTEGER_CHECK_ONE( int11, 11, (_factor) ); \ + INTEGER_CHECK_ONE( int12, 12, (_factor) ); \ + INTEGER_CHECK_ONE( int13, 13, (_factor) ); \ + INTEGER_CHECK_ONE( int14, 14, (_factor) ); \ + INTEGER_CHECK_ONE( int15, 15, (_factor) ); \ + INTEGER_CHECK_ONE( int16, 16, (_factor) ); \ + INTEGER_CHECK_ONE( int17, 17, (_factor) ); \ + INTEGER_CHECK_ONE( int18, 18, (_factor) ); \ + INTEGER_CHECK_ONE( int19, 19, (_factor) ); \ + INTEGER_CHECK_ONE( int20, 20, (_factor) ); \ + INTEGER_CHECK_ONE( int21, 21, (_factor) ); \ + INTEGER_CHECK_ONE( int22, 22, (_factor) ); \ + INTEGER_CHECK_ONE( int23, 23, (_factor) ); \ + INTEGER_CHECK_ONE( int24, 24, (_factor) ); \ + INTEGER_CHECK_ONE( int25, 25, (_factor) ); \ + INTEGER_CHECK_ONE( int26, 26, (_factor) ); \ + INTEGER_CHECK_ONE( int27, 27, (_factor) ); \ + INTEGER_CHECK_ONE( int28, 28, (_factor) ); \ + INTEGER_CHECK_ONE( int29, 29, (_factor) ); \ + INTEGER_CHECK_ONE( int30, 30, (_factor) ); \ + INTEGER_CHECK_ONE( int31, 31, (_factor) ); \ + INTEGER_CHECK_ONE( int32, 32, (_factor) ); \ + } while (0) + +#endif diff --git a/c/src/tests/sptests/sp19/sp19.doc b/c/src/tests/sptests/sp19/sp19.doc new file mode 100644 index 0000000000..78ac463c9f --- /dev/null +++ b/c/src/tests/sptests/sp19/sp19.doc @@ -0,0 +1,23 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test19 + +directives: + +concepts: + + a. Verifies system can dispatch a mixture of floating point and + non-floating point tasks. diff --git a/c/src/tests/sptests/sp19/sp19.scn b/c/src/tests/sptests/sp19/sp19.scn new file mode 100644 index 0000000000..76ded9f7d0 --- /dev/null +++ b/c/src/tests/sptests/sp19/sp19.scn @@ -0,0 +1,55 @@ +*** TEST 19 *** +FP1 - integer base = (0x6000) +FP1 - float base = (6000.6) +FP1 - integer base = (0x6000) +FP1 - float base = (6000.6) +TA1 - integer base = (0x1000) +TA1 - rtems_clock_get - 09:00:00 12/31/1988 +TA2 - integer base = (0x2000) +TA2 - rtems_clock_get - 09:00:00 12/31/1988 +TA3 - integer base = (0x3000) +TA3 - rtems_clock_get - 09:00:00 12/31/1988 +TA4 - integer base = (0x4000) +TA4 - float base = (4000.4) +TA4 - rtems_clock_get - 09:00:00 12/31/1988 +TA5 - integer base = (0x5000) +TA5 - float base = (5000.5) +TA5 - rtems_clock_get - 09:00:00 12/31/1988 +TA4 - rtems_clock_get - 09:00:01 12/31/1988 +TA5 - rtems_clock_get - 09:00:01 12/31/1988 +TA4 - rtems_clock_get - 09:00:02 12/31/1988 +TA5 - rtems_clock_get - 09:00:02 12/31/1988 +TA4 - rtems_clock_get - 09:00:03 12/31/1988 +TA5 - rtems_clock_get - 09:00:03 12/31/1988 +TA4 - rtems_clock_get - 09:00:04 12/31/1988 +TA5 - rtems_clock_get - 09:00:04 12/31/1988 +TA1 - rtems_clock_get - 09:00:05 12/31/1988 +TA4 - rtems_clock_get - 09:00:05 12/31/1988 +TA5 - rtems_clock_get - 09:00:05 12/31/1988 +TA4 - rtems_clock_get - 09:00:06 12/31/1988 +TA5 - rtems_clock_get - 09:00:06 12/31/1988 +TA4 - rtems_clock_get - 09:00:07 12/31/1988 +TA5 - rtems_clock_get - 09:00:07 12/31/1988 +TA4 - rtems_clock_get - 09:00:08 12/31/1988 +TA5 - rtems_clock_get - 09:00:08 12/31/1988 +TA4 - rtems_clock_get - 09:00:09 12/31/1988 +TA5 - rtems_clock_get - 09:00:09 12/31/1988 +TA1 - rtems_clock_get - 09:00:10 12/31/1988 +TA2 - rtems_clock_get - 09:00:10 12/31/1988 +TA4 - rtems_clock_get - 09:00:10 12/31/1988 +TA5 - rtems_clock_get - 09:00:10 12/31/1988 +TA4 - rtems_clock_get - 09:00:11 12/31/1988 +TA5 - rtems_clock_get - 09:00:11 12/31/1988 +TA4 - rtems_clock_get - 09:00:12 12/31/1988 +TA5 - rtems_clock_get - 09:00:12 12/31/1988 +TA4 - rtems_clock_get - 09:00:13 12/31/1988 +TA5 - rtems_clock_get - 09:00:13 12/31/1988 +TA4 - rtems_clock_get - 09:00:14 12/31/1988 +TA5 - rtems_clock_get - 09:00:14 12/31/1988 +TA1 - rtems_clock_get - 09:00:15 12/31/1988 +TA3 - rtems_clock_get - 09:00:15 12/31/1988 +TA4 - rtems_clock_get - 09:00:15 12/31/1988 +TA5 - rtems_clock_get - 09:00:15 12/31/1988 +TA4 - rtems_task_delete - self +TA5 - rtems_task_delete - TA3 +*** END OF TEST 19 *** diff --git a/c/src/tests/sptests/sp19/system.h b/c/src/tests/sptests/sp19/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/c/src/tests/sptests/sp19/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/c/src/tests/sptests/sp19/task1.c b/c/src/tests/sptests/sp19/task1.c new file mode 100644 index 0000000000..874fbcc614 --- /dev/null +++ b/c/src/tests/sptests/sp19/task1.c @@ -0,0 +1,59 @@ +/* Task_1 + * + * This routine serves as a test task. It verifies the basic task + * switching capabilities of the executive. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#include "inttest.h" + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_id tid; + rtems_time_of_day time; + rtems_unsigned32 task_index; + INTEGER_DECLARE; + + status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid ); + directive_failed( status, "rtems_task_ident" ); + + task_index = task_number( tid ); + + INTEGER_LOAD( INTEGER_factors[ task_index ] ); + + put_name( Task_name[ task_index ], FALSE ); + printf( " - integer base = (0x%x)\n", INTEGER_factors[ task_index ] ); + + while( FOREVER ) { + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_get" ); + + put_name( Task_name[ task_number( tid ) ], FALSE ); + print_time( " - rtems_clock_get - ", &time, "\n" ); + + INTEGER_CHECK( INTEGER_factors[ task_index ] ); + + status = rtems_task_wake_after( + ( task_number( tid ) ) * 5 * TICKS_PER_SECOND + ); + directive_failed( status, "rtems_task_wake_after" ); + } +} diff --git a/c/src/tests/sptests/sp20/getall.c b/c/src/tests/sptests/sp20/getall.c new file mode 100644 index 0000000000..cff3841dff --- /dev/null +++ b/c/src/tests/sptests/sp20/getall.c @@ -0,0 +1,43 @@ +/* Get_all_counters + * + * This routine allows TA5 to atomically obtain the iteration counters. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Get_all_counters() +{ + rtems_mode previous_mode; + rtems_status_code status; + + status = rtems_task_mode( + RTEMS_NO_PREEMPT, + RTEMS_PREEMPT_MASK, + &previous_mode + ); + directive_failed( status, "rtems_task_mode to RTEMS_NO_PREEMPT" ); + + Temporary_count = Count; + Count.count[ 1 ] = 0; + Count.count[ 2 ] = 0; + Count.count[ 3 ] = 0; + Count.count[ 4 ] = 0; + Count.count[ 5 ] = 0; + + status = rtems_task_mode( RTEMS_PREEMPT, RTEMS_PREEMPT_MASK, &previous_mode ); + directive_failed( status, "rtems_task_mode to RTEMS_PREEMPT" ); +} diff --git a/c/src/tests/sptests/sp20/init.c b/c/src/tests/sptests/sp20/init.c new file mode 100644 index 0000000000..95bdc3e728 --- /dev/null +++ b/c/src/tests/sptests/sp20/init.c @@ -0,0 +1,71 @@ +/* Init + * + * This routine is the initialization task for this test program. + * It is a user initialization task and has the responsibility for creating + * and starting the tasks that make up the test. If the time of day + * clock is required for the test, it should also be set to a known + * value by this function. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_unsigned32 index; + rtems_status_code status; + + puts( "\n\n*** TEST 20 ***" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' ); + Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' ); + + for ( index = 1 ; index <= 5 ; index++ ) { + status = rtems_task_create( + Task_name[ index ], + Priorities[ index ], + 4096, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ index ] + ); + directive_failed( status, "rtems_task_create loop" ); + } + + for ( index = 1 ; index <= 5 ; index++ ) { + status = rtems_task_start( Task_id[ index ], Task_1_through_5, index ); + directive_failed( status, "rtems_task_start loop" ); + } + + Count.count[ 1 ] = 0; + Count.count[ 2 ] = 0; + Count.count[ 3 ] = 0; + Count.count[ 4 ] = 0; + Count.count[ 5 ] = 0; + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/c/src/tests/sptests/sp20/sp20.doc b/c/src/tests/sptests/sp20/sp20.doc new file mode 100644 index 0000000000..4a029a4b89 --- /dev/null +++ b/c/src/tests/sptests/sp20/sp20.doc @@ -0,0 +1,24 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test20 + +directives: + + rm_create, rm_period + +concepts: + + a. Verifies Rate Monotonic Manager behavior. diff --git a/c/src/tests/sptests/sp20/sp20.scn b/c/src/tests/sptests/sp20/sp20.scn new file mode 100644 index 0000000000..1de3c18db8 --- /dev/null +++ b/c/src/tests/sptests/sp20/sp20.scn @@ -0,0 +1,27 @@ +*** TEST 20 *** +TA1 - rtems_rate_monotonic_create id = 0x00010001 +TA1 - rtems_rate_monotonic_ident id = 0x00010001 +TA1 - (0x00010001) period 2 +TA2 - rtems_rate_monotonic_create id = 0x00010002 +TA2 - rtems_rate_monotonic_ident id = 0x00010002 +TA2 - (0x00010002) period 2 +TA3 - rtems_rate_monotonic_create id = 0x00010003 +TA3 - rtems_rate_monotonic_ident id = 0x00010003 +TA3 - (0x00010003) period 2 +TA4 - rtems_rate_monotonic_create id = 0x00010004 +TA4 - rtems_rate_monotonic_ident id = 0x00010004 +TA4 - (0x00010004) period 2 +TA5 - rtems_rate_monotonic_create id = 0x00010005 +TA5 - rtems_rate_monotonic_ident id = 0x00010005 +TA5 - (0x00010005) period 50 +TA5 - PERIODS CHECK OK (1) +TA5 - PERIODS CHECK OK (2) +TA5 - PERIODS CHECK OK (3) +TA5 - PERIODS CHECK OK (4) +TA5 - PERIODS CHECK OK (5) +TA5 - PERIODS CHECK OK (6) +TA5 - PERIODS CHECK OK (7) +TA5 - PERIODS CHECK OK (8) +TA5 - PERIODS CHECK OK (9) +TA5 - PERIODS CHECK OK (10) +*** END OF TEST 20 *** diff --git a/c/src/tests/sptests/sp20/system.h b/c/src/tests/sptests/sp20/system.h new file mode 100644 index 0000000000..98d52a20cc --- /dev/null +++ b/c/src/tests/sptests/sp20/system.h @@ -0,0 +1,34 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +struct counters { + rtems_unsigned32 count[6]; +}; + +#include "gvar.h" + +/* end of include file */ diff --git a/c/src/tests/sptests/sp20/task1.c b/c/src/tests/sptests/sp20/task1.c new file mode 100644 index 0000000000..c5eda1a9ae --- /dev/null +++ b/c/src/tests/sptests/sp20/task1.c @@ -0,0 +1,116 @@ +/* Task_1_through_5 + * + * This routine serves as a test task for the period capabilities of the + * Rate Monotonic Manager. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_unsigned32 Periods[6] = { 0, 2, 2, 2, 2, 100 }; +rtems_unsigned32 Iterations[6] = { 0, 50, 50, 50, 50, 1 }; +rtems_task_priority Priorities[6] = { 0, 1, 1, 3, 4, 5 }; + +rtems_task Task_1_through_5( + rtems_unsigned32 argument +) +{ + rtems_id rmid; + rtems_id test_rmid; + rtems_unsigned32 index; + rtems_unsigned32 pass; + rtems_unsigned32 failed; + rtems_status_code status; + + status = rtems_rate_monotonic_create( argument, &rmid ); + directive_failed( status, "rtems_rate_monotonic_create" ); + put_name( Task_name[ argument ], FALSE ); + printf( "- rtems_rate_monotonic_create id = 0x%08x\n", rmid ); + + status = rtems_rate_monotonic_ident( argument, &test_rmid ); + directive_failed( status, "rtems_rate_monotonic_ident" ); + put_name( Task_name[ argument ], FALSE ); + printf( "- rtems_rate_monotonic_ident id = 0x%08x\n", test_rmid ); + + if ( rmid != test_rmid ) { + printf( "RMID's DO NOT MATCH (0x%x and 0x%x)\n", rmid, test_rmid ); + exit( 0 ); + } + + put_name( Task_name[ argument ], FALSE ); + printf( "- (0x%08x) period %d\n", rmid, Periods[ argument ] ); + + status = rtems_task_wake_after( 2 ); + directive_failed( status, "rtems_task_wake_after" ); + + switch ( argument ) { + case 1: + case 2: + case 3: + case 4: + while ( FOREVER ) { + status = rtems_rate_monotonic_period( rmid, Periods[ argument ] ); + directive_failed( status, "rtems_rate_monotonic_period" ); + Count.count[ argument ]++; + } + break; + case 5: + pass = 0; + failed = 0; + + status = rtems_rate_monotonic_period( rmid, Periods[ argument ] ); + directive_failed( status, "rtems_rate_monotonic_period 1 of TA5" ); + + Get_all_counters(); + + while ( FOREVER ) { + + status = rtems_rate_monotonic_period( rmid, Periods[ argument ] ); + directive_failed( status, "rtems_rate_monotonic_period 2 of TA5" ); + + Get_all_counters(); + + for( index = 1 ; index <= 4 ; index++ ) { + if ( Temporary_count.count[ index ] != Iterations[ index ] ) { + puts_nocr( "FAIL -- " ); + put_name ( Task_name[ index ], FALSE ); + printf ( " Actual=%d, Expected=%d\n", + Temporary_count.count[ index ], + Iterations[ index ] + ); + failed += 1; + } + } + + if ( failed == 5 ) + exit( 0 ); + + pass += 1; + + printf( "TA5 - PERIODS CHECK OK (%d)\n", pass ); + + fflush( stdout ); + + if ( pass == 10 ) { + puts( "*** END OF TEST 20 ***" ); + exit( 0 ); + } + + } + break; + } +} diff --git a/c/src/tests/sptests/sp21/init.c b/c/src/tests/sptests/sp21/init.c new file mode 100644 index 0000000000..bee9b931fc --- /dev/null +++ b/c/src/tests/sptests/sp21/init.c @@ -0,0 +1,56 @@ +/* Init + * + * This routine is the initialization task for this test program. + * It is a user initialization task and has the responsibility for creating + * and starting the tasks that make up the test. If the time of day + * clock is required for the test, it should also be set to a known + * value by this function. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TEST 21 ***" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/c/src/tests/sptests/sp21/sp21.doc b/c/src/tests/sptests/sp21/sp21.doc new file mode 100644 index 0000000000..55ed6282bc --- /dev/null +++ b/c/src/tests/sptests/sp21/sp21.doc @@ -0,0 +1,28 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test21 + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_delete + de_init, de_open, de_close, de_read, de_write, de_cntrl + +concepts: + + a. Verifies all I/O manager directives always return successful for + null drivers. + + b. Verifies all I/O manager directives call and return from the driver + entry points in the driver address table. diff --git a/c/src/tests/sptests/sp21/sp21.scn b/c/src/tests/sptests/sp21/sp21.scn new file mode 100644 index 0000000000..c6392e3ea3 --- /dev/null +++ b/c/src/tests/sptests/sp21/sp21.scn @@ -0,0 +1,19 @@ +*** TEST 21 *** +----- TESTING THE NULL DRIVER CHECKS ----- +TA1 - rtems_io_initialize - NULL DRIVER RTEMS_SUCCESSFUL +TA1 - rtems_io_open - NULL DRIVER RTEMS_SUCCESSFUL +TA1 - rtems_io_close - NULL DRIVER RTEMS_SUCCESSFUL +TA1 - rtems_io_read - NULL DRIVER RTEMS_SUCCESSFUL +TA1 - rtems_io_write - NULL DRIVER RTEMS_SUCCESSFUL +TA1 - rtems_io_control - NULL DRIVER RTEMS_SUCCESSFUL +----- TESTING THE I/O MANAGER DIRECTIVES ----- +TA1 - rtems_io_initialize - STUB DRIVER RTEMS_SUCCESSFUL +TA1 - rtems_io_open - STUB DRIVER RTEMS_SUCCESSFUL +TA1 - rtems_io_close - STUB DRIVER RTEMS_SUCCESSFUL +TA1 - rtems_io_read - STUB DRIVER RTEMS_SUCCESSFUL +TA1 - rtems_io_write - STUB DRIVER RTEMS_SUCCESSFUL +TA1 - rtems_io_control - STUB DRIVER RTEMS_SUCCESSFUL +----- RETURNING INVALID MAJOR NUMBER ----- +TA1 - rtems_io_initialize - RTEMS_INVALID_NUMBER +TA1 - rtems_io_open - RTEMS_INVALID_NUMBER +*** END OF TEST 21 *** diff --git a/c/src/tests/sptests/sp21/system.h b/c/src/tests/sptests/sp21/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/c/src/tests/sptests/sp21/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/c/src/tests/sptests/sp21/task1.c b/c/src/tests/sptests/sp21/task1.c new file mode 100644 index 0000000000..3c4b284a97 --- /dev/null +++ b/c/src/tests/sptests/sp21/task1.c @@ -0,0 +1,106 @@ +/* Task_1 + * + * This routine serves as a test task. It tests the I/O manager. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +#define STUB_DRIVER_MAJOR 0x2 +#define NO_DRIVER_MAJOR 0x1 +#define INVALID_DRIVER_MAJOR 0x5 + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_status_code return_value; + + puts( "----- TESTING THE NULL DRIVER CHECKS -----" ); + + status = rtems_io_initialize( NO_DRIVER_MAJOR, 0, NULL, &return_value ); + directive_failed( status, "rtems_io_initialize" ); + puts( "TA1 - rtems_io_initialize - NULL DRIVER RTEMS_SUCCESSFUL" ); + + status = rtems_io_open( NO_DRIVER_MAJOR, 0, NULL, &return_value ); + directive_failed( status, "rtems_io_open" ); + puts( "TA1 - rtems_io_open - NULL DRIVER RTEMS_SUCCESSFUL" ); + + status = rtems_io_close( NO_DRIVER_MAJOR, 0, NULL, &return_value ); + directive_failed( status, "rtems_io_close" ); + puts( "TA1 - rtems_io_close - NULL DRIVER RTEMS_SUCCESSFUL" ); + + status = rtems_io_read( NO_DRIVER_MAJOR, 0, NULL, &return_value ); + directive_failed( status, "rtems_io_read" ); + puts( "TA1 - rtems_io_read - NULL DRIVER RTEMS_SUCCESSFUL" ); + + status = rtems_io_write( NO_DRIVER_MAJOR, 0, NULL, &return_value ); + directive_failed( status, "rtems_io_write" ); + puts( "TA1 - rtems_io_write - NULL DRIVER RTEMS_SUCCESSFUL" ); + + status = rtems_io_control( NO_DRIVER_MAJOR, 0, NULL, &return_value ); + directive_failed( status, "rtems_io_control" ); + puts( "TA1 - rtems_io_control - NULL DRIVER RTEMS_SUCCESSFUL" ); + + puts( "----- TESTING THE I/O MANAGER DIRECTIVES -----" ); + + status = rtems_io_initialize( STUB_DRIVER_MAJOR, 0, NULL, &return_value ); + directive_failed( status, "rtems_io_initialize" ); + puts( "TA1 - rtems_io_initialize - STUB DRIVER RTEMS_SUCCESSFUL" ); + + status = rtems_io_open( STUB_DRIVER_MAJOR, 0, NULL, &return_value ); + directive_failed( status, "rtems_io_open" ); + puts( "TA1 - rtems_io_open - STUB DRIVER RTEMS_SUCCESSFUL" ); + + status = rtems_io_close( STUB_DRIVER_MAJOR, 0, NULL, &return_value ); + directive_failed( status, "rtems_io_close" ); + puts( "TA1 - rtems_io_close - STUB DRIVER RTEMS_SUCCESSFUL" ); + + status = rtems_io_read( STUB_DRIVER_MAJOR, 0, NULL, &return_value ); + directive_failed( status, "rtems_io_read" ); + puts( "TA1 - rtems_io_read - STUB DRIVER RTEMS_SUCCESSFUL" ); + + status = rtems_io_write( STUB_DRIVER_MAJOR, 0, NULL, &return_value ); + directive_failed( status, "rtems_io_write" ); + puts( "TA1 - rtems_io_write - STUB DRIVER RTEMS_SUCCESSFUL" ); + + status = rtems_io_control( STUB_DRIVER_MAJOR, 0, NULL, &return_value ); + directive_failed( status, "rtems_io_control" ); + puts( "TA1 - rtems_io_control - STUB DRIVER RTEMS_SUCCESSFUL" ); + + puts( "----- RETURNING INVALID MAJOR NUMBER -----" ); + + status = rtems_io_initialize( INVALID_DRIVER_MAJOR, 0, NULL, &return_value ); + fatal_directive_status( + status, + RTEMS_INVALID_NUMBER, + "rtems_io_initialize" + ); + puts( "TA1 - rtems_io_initialize - RTEMS_INVALID_NUMBER" ); + + status = rtems_io_open( INVALID_DRIVER_MAJOR, 0, NULL, &return_value ); + fatal_directive_status( + status, + RTEMS_INVALID_NUMBER, + "rtems_io_open" + ); + puts( "TA1 - rtems_io_open - RTEMS_INVALID_NUMBER" ); + + puts( "*** END OF TEST 21 ***" ); + exit( 0 ); +} diff --git a/c/src/tests/sptests/sp22/delay.c b/c/src/tests/sptests/sp22/delay.c new file mode 100644 index 0000000000..bcf9e014a7 --- /dev/null +++ b/c/src/tests/sptests/sp22/delay.c @@ -0,0 +1,32 @@ +/* Delayed_resume + * + * This routine is scheduled to be fired as a timer service routine. + * When fired this subprogram resumes Task_1. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_timer_service_routine Delayed_resume( + rtems_id ignored_id, + void *ignored_address +) +{ + rtems_status_code status; + + status = rtems_task_resume( Task_id[ 1 ] ); + directive_failed( status, "rtems_task_resume of self" ); +} diff --git a/c/src/tests/sptests/sp22/init.c b/c/src/tests/sptests/sp22/init.c new file mode 100644 index 0000000000..820fac81e3 --- /dev/null +++ b/c/src/tests/sptests/sp22/init.c @@ -0,0 +1,69 @@ +/* Init + * + * This routine is the initialization task for this test program. + * It is a user initialization task and has the responsibility for creating + * and starting the tasks that make up the test. If the time of day + * clock is required for the test, it should also be set to a known + * value by this function. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_time_of_day time; + rtems_status_code status; + + puts( "\n\n*** TEST 22 ***" ); + + build_time( &time, 12, 31, 1988, 9, 0, 0, 0 ); + + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + puts( "INIT - rtems_timer_create - creating timer 1" ); + status = rtems_timer_create( Timer_name[ 1 ], &Timer_id[ 1 ] ); + directive_failed( status, "rtems_timer_create" ); + + printf( "INIT - timer 1 has id (0x%x)\n", Timer_id[ 1 ] ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/c/src/tests/sptests/sp22/prtime.c b/c/src/tests/sptests/sp22/prtime.c new file mode 100644 index 0000000000..f3871eb9fd --- /dev/null +++ b/c/src/tests/sptests/sp22/prtime.c @@ -0,0 +1,32 @@ +/* Print_time + * + * This routine prints the name of Task_1 and the current time of day. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +void Print_time( void ) +{ + rtems_time_of_day time; + rtems_status_code status; + + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_get" ); + + put_name( Task_name[ 1 ], FALSE ); + print_time( "- rtems_clock_get - ", &time, "\n" ); +} diff --git a/c/src/tests/sptests/sp22/sp22.doc b/c/src/tests/sptests/sp22/sp22.doc new file mode 100644 index 0000000000..9208d7a695 --- /dev/null +++ b/c/src/tests/sptests/sp22/sp22.doc @@ -0,0 +1,20 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test22 + +directives: + +concepts: diff --git a/c/src/tests/sptests/sp22/sp22.scn b/c/src/tests/sptests/sp22/sp22.scn new file mode 100644 index 0000000000..6402ab4482 --- /dev/null +++ b/c/src/tests/sptests/sp22/sp22.scn @@ -0,0 +1,29 @@ +*** TEST 22 *** +INIT - rtems_timer_create - creating timer 1 +INIT - timer 1 has id (0x10001) +TA1 - rtems_timer_ident - identing timer 1 +TA1 - timer 1 has id (0x10001) +TA1 - rtems_clock_get - 09:00:00 12/31/1988 +TA1 - rtems_timer_fire_after - timer 1 in 3 seconds +TA1 - rtems_task_suspend( RTEMS_SELF ) +TA1 - rtems_clock_get - 09:00:03 12/31/1988 +TA1 - rtems_timer_fire_after - timer 1 in 3 seconds +TA1 - rtems_task_wake_after - 1 second +TA1 - rtems_clock_get - 09:00:04 12/31/1988 +TA1 - rtems_timer_reset - timer 1 +TA1 - rtems_task_suspend( RTEMS_SELF ) +TA1 - rtems_clock_get - 09:00:07 12/31/1988 + +TA1 - rtems_timer_fire_after - timer 1 in 3 seconds +TA1 - rtems_timer_cancel - timer 1 +TA1 - rtems_clock_get - 09:00:07 12/31/1988 +TA1 - rtems_timer_fire_when - timer 1 in 3 seconds +TA1 - rtems_task_suspend( RTEMS_SELF ) +TA1 - rtems_clock_get - 09:00:10 12/31/1988 +TA1 - rtems_timer_fire_when - timer 1 in 3 seconds +TA1 - rtems_task_wake_after - 1 second +TA1 - rtems_clock_get - 09:00:11 12/31/1988 +TA1 - rtems_timer_cancel - timer 1 +TA1 - rtems_task_wake_after - YIELD (only task at priority) +TA1 - timer_deleting - timer 1 +*** END OF TEST 22 *** diff --git a/c/src/tests/sptests/sp22/system.h b/c/src/tests/sptests/sp22/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/c/src/tests/sptests/sp22/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/c/src/tests/sptests/sp22/task1.c b/c/src/tests/sptests/sp22/task1.c new file mode 100644 index 0000000000..240a1972cc --- /dev/null +++ b/c/src/tests/sptests/sp22/task1.c @@ -0,0 +1,164 @@ +/* Task_1 + * + * This routine serves as a test task. It verifies the basic task + * switching capabilities of the executive. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_id tmid; + rtems_time_of_day time; + rtems_status_code status; + +/* Get id */ + + puts( "TA1 - rtems_timer_ident - identing timer 1" ); + status = rtems_timer_ident( Timer_name[ 1 ], &tmid ); + directive_failed( status, "rtems_timer_ident" ); + printf( "TA1 - timer 1 has id (0x%x)\n", tmid ); + +/* after which is allowed to fire */ + + Print_time(); + + puts( "TA1 - rtems_timer_fire_after - timer 1 in 3 seconds" ); + status = rtems_timer_fire_after( + tmid, + 3 * TICKS_PER_SECOND, + Delayed_resume, + NULL + ); + directive_failed( status, "rtems_timer_fire_after" ); + + puts( "TA1 - rtems_task_suspend( RTEMS_SELF )" ); + status = rtems_task_suspend( RTEMS_SELF ); + directive_failed( status, "rtems_task_suspend" ); + + Print_time(); + +/* after which is reset and allowed to fire */ + + puts( "TA1 - rtems_timer_fire_after - timer 1 in 3 seconds" ); + status = rtems_timer_fire_after( + tmid, + 3 * TICKS_PER_SECOND, + Delayed_resume, + NULL + ); + directive_failed( status, "rtems_timer_fire_after" ); + + puts( "TA1 - rtems_task_wake_after - 1 second" ); + status = rtems_task_wake_after( 1 * TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + Print_time(); + + puts( "TA1 - rtems_timer_reset - timer 1" ); + status = rtems_timer_reset( tmid ); + directive_failed( status, "rtems_timer_reset" ); + + puts( "TA1 - rtems_task_suspend( RTEMS_SELF )" ); + status = rtems_task_suspend( RTEMS_SELF ); + directive_failed( status, "rtems_task_suspend" ); + + Print_time(); + + pause(); + + /* + * Reset the time since we do not know how long the user waited + * before pressing at the pause. This insures that the + * actual output matches the screen. + */ + + build_time( &time, 12, 31, 1988, 9, 0, 7, 0 ); + + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + +/* after which is canceled */ + + puts( "TA1 - rtems_timer_fire_after - timer 1 in 3 seconds" ); + status = rtems_timer_fire_after( + tmid, + 3 * TICKS_PER_SECOND, + Delayed_resume, + NULL + ); + directive_failed( status, "rtems_timer_fire_after" ); + + puts( "TA1 - rtems_timer_cancel - timer 1" ); + status = rtems_timer_cancel( tmid ); + directive_failed( status, "rtems_timer_cancel" ); + +/* when which is allowed to fire */ + + Print_time(); + + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_get" ); + + time.second += 3; + + puts( "TA1 - rtems_timer_fire_when - timer 1 in 3 seconds" ); + status = rtems_timer_fire_when( tmid, &time, Delayed_resume, NULL ); + directive_failed( status, "rtems_timer_fire_when" ); + + puts( "TA1 - rtems_task_suspend( RTEMS_SELF )" ); + status = rtems_task_suspend( RTEMS_SELF ); + directive_failed( status, "rtems_task_suspend" ); + + Print_time(); + +/* when which is canceled */ + + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_get" ); + + time.second += 3; + + puts( "TA1 - rtems_timer_fire_when - timer 1 in 3 seconds" ); + status = rtems_timer_fire_when( tmid, &time, Delayed_resume, NULL ); + directive_failed( status, "rtems_timer_fire_when" ); + + puts( "TA1 - rtems_task_wake_after - 1 second" ); + status = rtems_task_wake_after( 1 * TICKS_PER_SECOND ); + directive_failed( status, "rtems_task_wake_after" ); + + Print_time(); + + puts( "TA1 - rtems_timer_cancel - timer 1" ); + status = rtems_timer_cancel( tmid ); + directive_failed( status, "rtems_timer_cancel" ); + +/* delete */ + puts( "TA1 - rtems_task_wake_after - YIELD (only task at priority)" ); + status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR ); + directive_failed( status, "rtems_task_wake_after" ); + + puts( "TA1 - timer_deleting - timer 1" ); + status = rtems_timer_delete( tmid ); + directive_failed( status, "rtems_timer_delete" ); + + puts( "*** END OF TEST 22 *** " ); + exit( 0 ); +} diff --git a/c/src/tests/sptests/sp23/init.c b/c/src/tests/sptests/sp23/init.c new file mode 100644 index 0000000000..5acaf67e42 --- /dev/null +++ b/c/src/tests/sptests/sp23/init.c @@ -0,0 +1,72 @@ +/* Init + * + * This routine is the initialization task for this test program. + * It is a user initialization task and has the responsibility for creating + * and starting the tasks that make up the test. If the time of day + * clock is required for the test, it should also be set to a known + * value by this function. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TEST 23 ***" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + Port_name[ 1 ] = rtems_build_name( 'D', 'P', '1', ' ' ); + + status = rtems_port_create( + Port_name[ 1 ], + Internal_port_area, + External_port_area, + 0xff, + &Port_id[ 1 ] + ); + directive_failed( status, "rtems_port_create of DP1" ); + + printf( "INIT - rtems_port_create - DP1 - int = %p ext = %p\n", + Internal_port_area, + External_port_area + ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/c/src/tests/sptests/sp23/sp23.doc b/c/src/tests/sptests/sp23/sp23.doc new file mode 100644 index 0000000000..485a4ec466 --- /dev/null +++ b/c/src/tests/sptests/sp23/sp23.doc @@ -0,0 +1,26 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test23 + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_delete, + m_ext2int, m_int2ext + +concepts: + + a. Verifies the dual ported RAM directives work correctly. + +output: diff --git a/c/src/tests/sptests/sp23/sp23.scn b/c/src/tests/sptests/sp23/sp23.scn new file mode 100644 index 0000000000..7529abd4c4 --- /dev/null +++ b/c/src/tests/sptests/sp23/sp23.scn @@ -0,0 +1,9 @@ +*** TEST 23 *** +INIT - rtems_port_create - DP1 - int = 0x00001000 ext = 0x00002000 +TA1 - rtems_port_ident - 00010001 +TA1 - rtems_port_external_to_internal - 0x0000200e => 0x0000100e +TA1 - rtems_port_internal_to_external - 0x0000100e => 0x0000200e +TA1 - rtems_port_external_to_internal - 0x0000300e => 0x0000300e +TA1 - rtems_port_internal_to_external - 0x0000050e => 0x0000050e +TA1 - rtems_port_delete - DP1 +*** END OF TEST 23 *** diff --git a/c/src/tests/sptests/sp23/system.h b/c/src/tests/sptests/sp23/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/c/src/tests/sptests/sp23/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/c/src/tests/sptests/sp23/task1.c b/c/src/tests/sptests/sp23/task1.c new file mode 100644 index 0000000000..5012616131 --- /dev/null +++ b/c/src/tests/sptests/sp23/task1.c @@ -0,0 +1,96 @@ +/* Task_1 + * + * This task verifies that the dual ported RAM directives work + * correctly by converting external addresses to internal addresses and + * internal addresses to external addresses. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_1( + rtems_task_argument argument +) +{ + rtems_id dpid; + void *to_be_converted; + void *converted; + rtems_status_code status; + + status = rtems_port_ident( Port_name[ 1 ], &dpid ); + directive_failed( status, "rtems_port_ident" ); + printf( "TA1 - rtems_port_ident - %08x\n", dpid ); + + to_be_converted = &External_port_area[ 0xe ]; + status = rtems_port_external_to_internal( + Port_id[ 1 ], + to_be_converted, + &converted + ); + directive_failed( status, "rtems_port_external_to_internal" ); + printf( + "TA1 - rtems_port_external_to_internal - %p => %p\n", + to_be_converted, + converted + ); + + to_be_converted = &Internal_port_area[ 0xe ]; + status = rtems_port_internal_to_external( + Port_id[ 1 ], + to_be_converted, + &converted + ); + directive_failed( status, "rtems_port_internal_to_external" ); + printf( + "TA1 - rtems_port_internal_to_external - %p => %p\n", + to_be_converted, + converted + ); + + to_be_converted = &Above_port_area[ 0xe ]; + status = rtems_port_external_to_internal( + Port_id[ 1 ], + to_be_converted, + &converted + ); + directive_failed( status, "rtems_port_external_to_internal" ); + printf( + "TA1 - rtems_port_external_to_internal - %p => %p\n", + to_be_converted, + converted + ); + + to_be_converted = &Below_port_area[ 0xe ]; + status = rtems_port_internal_to_external( + Port_id[ 1 ], + to_be_converted, + &converted + ); + directive_failed( status, "rtems_port_internal_to_external" ); + printf( + "TA1 - rtems_port_internal_to_external - %p => %p\n", + to_be_converted, + converted + ); + + status = rtems_port_delete( Port_id[ 1 ] ); + directive_failed( status, "rtems_port_delete" ); + puts( "TA1 - rtems_port_delete - DP1" ); + + puts( "*** END OF TEST 23 ***" ); + exit( 0 ); +} diff --git a/c/src/tests/sptests/sp24/init.c b/c/src/tests/sptests/sp24/init.c new file mode 100644 index 0000000000..c73830a6df --- /dev/null +++ b/c/src/tests/sptests/sp24/init.c @@ -0,0 +1,79 @@ +/* Init + * + * This routine is the initialization task for this test program. + * It is a user initialization task and has the responsibility for creating + * and starting the tasks that make up the test. If the time of day + * clock is required for the test, it should also be set to a known + * value by this function. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_time_of_day time; + rtems_unsigned32 index; + rtems_status_code status; + + puts( "\n\n*** TEST 24 ***" ); + + build_time( &time, 12, 31, 1988, 9, 0, 0, 0 ); + + status = rtems_clock_set( &time ); + directive_failed( status, "rtems_clock_set" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' ); + Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' ); + + Timer_name[ 1 ] = rtems_build_name( 'T', 'M', '1', ' ' ); + Timer_name[ 2 ] = rtems_build_name( 'T', 'M', '2', ' ' ); + Timer_name[ 3 ] = rtems_build_name( 'T', 'M', '3', ' ' ); + + for ( index = 1 ; index <= 3 ; index++ ) { + status = rtems_task_create( + Task_name[ index ], + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ index ] + ); + directive_failed( status, "rtems_task_create loop" ); + + status = rtems_timer_create( + Timer_name[ index ], + &Timer_id[ index ] + ); + directive_failed( status, "rtems_timer_create loop" ); + } + + for ( index = 1 ; index <= 3 ; index++ ) { + status = rtems_task_start( Task_id[ index ], Task_1_through_3, index ); + directive_failed( status, "rtems_task_start loop" ); + } + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/c/src/tests/sptests/sp24/resume.c b/c/src/tests/sptests/sp24/resume.c new file mode 100644 index 0000000000..c73696c109 --- /dev/null +++ b/c/src/tests/sptests/sp24/resume.c @@ -0,0 +1,34 @@ +/* Resume_task + * + * This subprogram is scheduled as a timer service routine. When + * it fires it resumes the task which is mapped to this timer. + * + * Input parameters: NONE + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_timer_service_routine Resume_task( + rtems_id timer_id, + void *ignored_address +) +{ + rtems_id task_to_resume; + rtems_status_code status; + + task_to_resume = Task_id[ rtems_get_index( timer_id ) ]; + status = rtems_task_resume( task_to_resume ); + directive_failed( status, "rtems_task_resume" ); +} diff --git a/c/src/tests/sptests/sp24/sp24.doc b/c/src/tests/sptests/sp24/sp24.doc new file mode 100644 index 0000000000..14b743d588 --- /dev/null +++ b/c/src/tests/sptests/sp24/sp24.doc @@ -0,0 +1,51 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test24 + +directives: + ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident, + ev_receive + +concepts: + + a. This test is a cyclic version of test1. The times printed by + each test should not skew as in test1 (see output section). + + b. Verifies system can create and start both the executive's system + initialization and idle task. + + c. Verifies executive can swap between three application tasks at the + same priority and the executive's internal idle task. + + d. Verifies can print strings to the CRT on port 2 of the mvme136 board + using Print and Println in the board support package. + + e. Verifies interrupt handler can handler a task switch from an interrupt + as specified with the i_return directive. + + f. Verifies executive initialization performed correctly. + + g. Verifies the executive trap handler except for the halt function. + + h. Verifies that a task can get the task identification number of itself. + +output: + "TA1" is printed once every 5 seconds. "TA2" is printed once + every 10 seconds. "TA3" is printed once every 15 seconds. + + The times printed should be multiples of 5 seconds for TA1, 10 seconds + for TA2, and 15 seconds for TA3. If this does not happen, the calendar + time does not correspond correctly to the number of ticks. diff --git a/c/src/tests/sptests/sp24/sp24.scn b/c/src/tests/sptests/sp24/sp24.scn new file mode 100644 index 0000000000..577dc4f7b2 --- /dev/null +++ b/c/src/tests/sptests/sp24/sp24.scn @@ -0,0 +1,16 @@ +*** TEST 24 *** +TA1 - rtems_clock_get - 09:00:00 12/31/1988 +TA2 - rtems_clock_get - 09:00:00 12/31/1988 +TA3 - rtems_clock_get - 09:00:00 12/31/1988 +TA1 - rtems_clock_get - 09:00:05 12/31/1988 +TA1 - rtems_clock_get - 09:00:10 12/31/1988 +TA2 - rtems_clock_get - 09:00:10 12/31/1988 +TA1 - rtems_clock_get - 09:00:15 12/31/1988 +TA3 - rtems_clock_get - 09:00:15 12/31/1988 +TA1 - rtems_clock_get - 09:00:20 12/31/1988 +TA2 - rtems_clock_get - 09:00:20 12/31/1988 +TA1 - rtems_clock_get - 09:00:25 12/31/1988 +TA1 - rtems_clock_get - 09:00:30 12/31/1988 +TA2 - rtems_clock_get - 09:00:30 12/31/1988 +TA3 - rtems_clock_get - 09:00:30 12/31/1988 +*** END OF TEST 24 *** diff --git a/c/src/tests/sptests/sp24/system.h b/c/src/tests/sptests/sp24/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/c/src/tests/sptests/sp24/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/c/src/tests/sptests/sp24/task1.c b/c/src/tests/sptests/sp24/task1.c new file mode 100644 index 0000000000..bb3540acee --- /dev/null +++ b/c/src/tests/sptests/sp24/task1.c @@ -0,0 +1,58 @@ +/* Task_1_through_3 + * + * This task is a cyclic version of test1 to asssure that the times + * displayed are not skewed as in test1. "TA1" is printed once every + * 5 seconds, "TA2" is printed once every 10 seconds, and "TA3" is + * printed once every 15 seconds. The times displayed should be + * in multiples of 5, 10, and 15 for TA1, TA2, and TA3 respectively. + * If the times are skewed from these values, then the calendar time + * does not correspond correctly with the number of ticks. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_1_through_3( + rtems_task_argument argument +) +{ + rtems_id tid; + rtems_time_of_day time; + rtems_status_code status; + + status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid ); + directive_failed( status, "rtems_task_ident of self" ); + + while ( FOREVER ) { + status = rtems_timer_fire_after( + Timer_id[ argument ], + task_number( tid ) * 5 * TICKS_PER_SECOND, + Resume_task, + NULL + ); + directive_failed( status, "tm_fire_after failed" ); + + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + directive_failed( status, "rtems_clock_get failed" ); + + if ( time.second >= 35 ) { + puts( "*** END OF TEST 24 ***" ); + exit( 0 ); + } + + put_name( Task_name[ task_number( tid ) ], FALSE ); + print_time( " - rtems_clock_get - ", &time, "\n" ); + + status = rtems_task_suspend( RTEMS_SELF ); + directive_failed( status, "rtems_task_suspend" ); + } +} diff --git a/c/src/tests/sptests/sp25/init.c b/c/src/tests/sptests/sp25/init.c new file mode 100644 index 0000000000..fcd5b3dfd6 --- /dev/null +++ b/c/src/tests/sptests/sp25/init.c @@ -0,0 +1,69 @@ +/* Init + * + * This routine is the initialization task for this test program. + * It is a user initialization task and has the responsibility for creating + * and starting the tasks that make up the test. If the time of day + * clock is required for the test, it should also be set to a known + * value by this function. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + puts( "\n\n*** TEST 25 ***" ); + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + BASE_PRIORITY, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + Region_name[ 1 ] = rtems_build_name('R', 'N', '0', '1'); + + + status = rtems_region_create( + Region_name[ 1 ], + Area_1, + sizeof( Area_1 ), + 64, + RTEMS_DEFAULT_ATTRIBUTES, + &Region_id[ 1 ] + ); + directive_failed( status, "rtems_region_create of RN1" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/c/src/tests/sptests/sp25/sp25.doc b/c/src/tests/sptests/sp25/sp25.doc new file mode 100644 index 0000000000..98684f53b3 --- /dev/null +++ b/c/src/tests/sptests/sp25/sp25.doc @@ -0,0 +1,32 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: test25 + +directives: + task_create + task_start + task_delete + region_create + region_ident + region_get_segment + region_return_segment + region_delete + +concepts: + + a. Verifies that the heap maintains it's integrity trhough a series + on region_get_segments and region_return_segments. + diff --git a/c/src/tests/sptests/sp25/sp25.scn b/c/src/tests/sptests/sp25/sp25.scn new file mode 100644 index 0000000000..1944f18f4b --- /dev/null +++ b/c/src/tests/sptests/sp25/sp25.scn @@ -0,0 +1,29 @@ +*** TEST 25 *** +TA1 - rtems_region_ident - 00010002 +TA1 - rtems_region_get_segment - wait on 64 byte segment from region 1 +TA1 - got segment from region 1 - 0x0000f9b8 +TA1 - rtems_region_get_segment - wait on 128 byte segment from region 1 +TA1 - got segment from region 1 - 0x0000f930 +TA1 - rtems_region_get_segment - wait on 256 byte segment from region 1 +TA1 - got segment from region 1 - 0x0000f828 +TA1 - rtems_region_get_segment - wait on 512 byte segment from region 1 +TA1 - got segment from region 1 - 0x0000f620 +TA1 - rtems_region_get_segment - wait on 1024 byte segment from region 1 +TA1 - got segment from region 1 - 0x0000f218 +TA1 - rtems_region_get_segment - wait on 2048 byte segment from region 1 +TA1 - got segment from region 1 - 0x0000ea10 +TA1 - rtems_region_get_segment - wait on 4096 byte segment from region 1 +TA1 - got segment from region 1 - 0x0000da08 +TA1 - rtems_region_get_segment - wait on 8192 byte segment from region 1 +TA1 - got segment from region 1 - 0x0000ba00 + +TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000f828 +TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000f620 +TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000f9b8 +TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000f930 +TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000da08 +TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000ea10 +TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000ba00 +TA1 - rtems_region_return_segment - return segment to region 1 - 0x0000f218 +TA1 - rtems_region_delete - walks heap if debug enabled +*** END OF TEST 25 *** diff --git a/c/src/tests/sptests/sp25/system.h b/c/src/tests/sptests/sp25/system.h new file mode 100644 index 0000000000..9e2b748a85 --- /dev/null +++ b/c/src/tests/sptests/sp25/system.h @@ -0,0 +1,32 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +#define BASE_PRIORITY 140 /* all tasks priority */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/c/src/tests/sptests/sp25/task1.c b/c/src/tests/sptests/sp25/task1.c new file mode 100644 index 0000000000..6222c4e734 --- /dev/null +++ b/c/src/tests/sptests/sp25/task1.c @@ -0,0 +1,241 @@ +/* Task_1 + * + * This routine serves as a test task. It tests the region manager. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_1( + rtems_task_argument argument +) +{ + void *address_1; + void *address_2; + void *address_3; + void *address_4; + void *address_5; + void *address_6; + void *address_7; + void *address_8; + rtems_status_code status; + rtems_id region_id; + + status = rtems_region_ident(Region_name[ 1 ], ®ion_id); + printf( "TA1 - rtems_region_ident - %08x\n", region_id ); + directive_failed(status, "rtems_region_ident of RN01"); + + puts( + "TA1 - rtems_region_get_segment - wait on 64 byte segment from region 1" + ); + rtems_region_get_segment( + Region_id[ 1 ], + 64, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &address_1 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA1 - got segment from region 1 - " ); + Put_address_from_area_1( address_1 ); + new_line; + + puts( + "TA1 - rtems_region_get_segment - wait on 128 byte segment from region 1" + ); + rtems_region_get_segment( + Region_id[ 1 ], + 128, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &address_2 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA1 - got segment from region 1 - " ); + Put_address_from_area_1( address_2 ); + new_line; + + puts( + "TA1 - rtems_region_get_segment - wait on 256 byte segment from region 1" + ); + rtems_region_get_segment( + Region_id[ 1 ], + 256, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &address_3 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA1 - got segment from region 1 - " ); + Put_address_from_area_1( address_3 ); + new_line; + + puts( + "TA1 - rtems_region_get_segment - wait on 512 byte segment from region 1" + ); + rtems_region_get_segment( + Region_id[ 1 ], + 512, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &address_4 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA1 - got segment from region 1 - " ); + Put_address_from_area_1( address_4 ); + new_line; + + puts( + "TA1 - rtems_region_get_segment - wait on 1024 byte segment from region 1" + ); + rtems_region_get_segment( + Region_id[ 1 ], + 1024, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &address_5 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA1 - got segment from region 1 - " ); + Put_address_from_area_1( address_5 ); + new_line; + + puts( + "TA1 - rtems_region_get_segment - wait on 2048 byte segment from region 1" + ); + rtems_region_get_segment( + Region_id[ 1 ], + 2048, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &address_6 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA1 - got segment from region 1 - " ); + Put_address_from_area_1( address_6 ); + new_line; + + puts( + "TA1 - rtems_region_get_segment - wait on 4096 byte segment from region 1" + ); + rtems_region_get_segment( + Region_id[ 1 ], + 4096, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &address_7 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA1 - got segment from region 1 - " ); + Put_address_from_area_1( address_7 ); + new_line; + + puts( + "TA1 - rtems_region_get_segment - wait on 8192 byte segment from region 1" + ); + rtems_region_get_segment( + Region_id[ 1 ], + 8192, + RTEMS_DEFAULT_OPTIONS, + RTEMS_NO_TIMEOUT, + &address_8 + ); + directive_failed( status, "rtems_region_get_segment" ); + puts_nocr( "TA1 - got segment from region 1 - " ); + Put_address_from_area_1( address_8 ); + new_line; + +pause(); + + puts_nocr( + "TA1 - rtems_region_return_segment - return segment to region 1 - " + ); + Put_address_from_area_1( address_3 ); + status = rtems_region_return_segment( Region_id[ 1 ], address_3 ); + directive_failed( status, "rtems_region_return_segment" ); + new_line; + address_3 = 0; + + puts_nocr( + "TA1 - rtems_region_return_segment - return segment to region 1 - " + ); + Put_address_from_area_1( address_4 ); + status = rtems_region_return_segment( Region_id[ 1 ], address_4 ); + directive_failed( status, "rtems_region_return_segment" ); + new_line; + address_4 = 0; + + puts_nocr( + "TA1 - rtems_region_return_segment - return segment to region 1 - " + ); + Put_address_from_area_1( address_1 ); + status = rtems_region_return_segment( Region_id[ 1 ], address_1 ); + directive_failed( status, "rtems_region_return_segment" ); + new_line; + address_1 = 0; + + puts_nocr( + "TA1 - rtems_region_return_segment - return segment to region 1 - " + ); + Put_address_from_area_1( address_2 ); + status = rtems_region_return_segment( Region_id[ 1 ], address_2 ); + directive_failed( status, "rtems_region_return_segment" ); + new_line; + address_2 = 0; + + puts_nocr( + "TA1 - rtems_region_return_segment - return segment to region 1 - " + ); + Put_address_from_area_1( address_7 ); + status = rtems_region_return_segment( Region_id[ 1 ], address_7 ); + directive_failed( status, "rtems_region_return_segment" ); + new_line; + address_7 = 0; + + puts_nocr( + "TA1 - rtems_region_return_segment - return segment to region 1 - " + ); + Put_address_from_area_1( address_6 ); + status = rtems_region_return_segment( Region_id[ 1 ], address_6 ); + directive_failed( status, "rtems_region_return_segment" ); + new_line; + address_6 = 0; + + puts_nocr( + "TA1 - rtems_region_return_segment - return segment to region 1 - " + ); + Put_address_from_area_1( address_8 ); + status = rtems_region_return_segment( Region_id[ 1 ], address_8 ); + directive_failed( status, "rtems_region_return_segment" ); + new_line; + address_8 = 0; + + puts_nocr( + "TA1 - rtems_region_return_segment - return segment to region 1 - " + ); + Put_address_from_area_1( address_5 ); + status = rtems_region_return_segment( Region_id[ 1 ], address_5 ); + directive_failed( status, "rtems_region_return_segment" ); + new_line; + address_5 = 0; + + puts( "TA1 - rtems_region_delete - walks heap if debug enabled" ); + rtems_region_delete(Region_id[ 1 ]); + + puts( "*** END OF TEST 25 ***" ); + exit( 0 ); +} diff --git a/c/src/tests/sptests/spfatal/fatal.c b/c/src/tests/sptests/spfatal/fatal.c new file mode 100644 index 0000000000..3b2228bffd --- /dev/null +++ b/c/src/tests/sptests/spfatal/fatal.c @@ -0,0 +1,134 @@ +/* Fatal Error Test + * + * NOTE: + * + * This test actually modifies the Configuration table and restarts + * the executive. It is very carefully constructed to do this and + * uses the Configuration very carefully. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +#include + +char Workspace[ 64 * 1024 ] CPU_STRUCTURE_ALIGNMENT; + +typedef enum { + FATAL_WORKSPACE_OF_ZERO, + FATAL_NULL_WORKSPACE, + FATAL_WORKSPACE_TOO_SMALL, + FATAL_TASK_CREATE, + FATAL_TASK_START +} Fatal_errors_t; + +#define FATAL_LAST FATAL_TASK_START + +volatile Fatal_errors_t Case_in_switch; + +rtems_status_code Expected_Errors[] = { + RTEMS_UNSATISFIED, + RTEMS_INVALID_ADDRESS, + RTEMS_UNSATISFIED, + RTEMS_INVALID_PRIORITY, + RTEMS_TASK_EXITTED +}; + +rtems_status_code Error_Happened[ FATAL_LAST + 1]; + +jmp_buf Restart_Context; + +/* + * We depend on this being zeroed during initialization. This + * occurs automatically because this is part of the BSS. + */ + +rtems_unsigned32 First_Time_Through; + +void Process_case(); + +rtems_extension Fatal_extension( + rtems_unsigned32 error +) +{ + int index; + + Error_Happened[ Case_in_switch ] = error; + + if ( First_Time_Through == 0 ) { + Case_in_switch = FATAL_WORKSPACE_OF_ZERO; + First_Time_Through = 1; + setjmp( Restart_Context ); + } else if ( Case_in_switch == FATAL_LAST ) { + + /* + * Depending on the C library we use, we cannot get the + * task exitted error so do not check for it. + */ + + puts( "*** TEST FATAL ***" ); + for ( index=0 ; index< FATAL_LAST ; index++ ) + put_error( Error_Happened[ index ], Expected_Errors[ index ] ); + puts( "NOT TESTING FATAL ERROR WHEN TASK EXITS -- C LIBRARY CATCHES THIS" ); + puts( "*** END OF TEST FATAL ***" ); + + /* + * returns to the default fatal error handler instead of + * calling rtems_shutdown_executive + */ + return; + + } else { + + longjmp( Restart_Context, 1 ); + } + + Process_case(); +} + + + +void Process_case() +{ + switch ( Case_in_switch ) { + case FATAL_WORKSPACE_OF_ZERO: + New_Configuration = BSP_Configuration; + New_Configuration.work_space_start = NULL; + Case_in_switch = FATAL_NULL_WORKSPACE; + break; + + case FATAL_NULL_WORKSPACE: + New_Configuration.work_space_start = Workspace; + New_Configuration.work_space_size = 256; + Case_in_switch = FATAL_WORKSPACE_TOO_SMALL; + break; + + case FATAL_WORKSPACE_TOO_SMALL: + Initialization_tasks[ 0 ].initial_priority = RTEMS_CURRENT_PRIORITY; + New_Configuration.work_space_size = sizeof( Workspace ); + Case_in_switch = FATAL_TASK_CREATE; + break; + + case FATAL_TASK_CREATE: + Initialization_tasks[ 0 ].initial_priority = 1; + Initialization_tasks[ 0 ].entry_point = NULL; + Case_in_switch = FATAL_TASK_START; + break; + + case FATAL_TASK_START: + /* this extension exits the test */ + Initialization_tasks[ 0 ].entry_point = Init; + break; + } + rtems_initialize_executive( &New_Configuration, &Cpu_table ); +} + diff --git a/c/src/tests/sptests/spfatal/init.c b/c/src/tests/sptests/spfatal/init.c new file mode 100644 index 0000000000..a50c6101f5 --- /dev/null +++ b/c/src/tests/sptests/spfatal/init.c @@ -0,0 +1,54 @@ +/* Init + * + * This routine is the initialization task for this test program. + * It is a user initialization task and has the responsibility for creating + * and starting the tasks that make up the test. If the time of day + * clock is required for the test, it should also be set to a known + * value by this function. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + + Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' ); + + status = rtems_task_create( + Task_name[ 1 ], + 1, + 2048, + RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, + &Task_id[ 1 ] + ); + directive_failed( status, "rtems_task_create of TA1" ); + + status = rtems_task_start( Task_id[ 1 ], Task_1, 0 ); + directive_failed( status, "rtems_task_start of TA1" ); + + status = rtems_task_delete( RTEMS_SELF ); + directive_failed( status, "rtems_task_delete of RTEMS_SELF" ); +} diff --git a/c/src/tests/sptests/spfatal/puterr.c b/c/src/tests/sptests/spfatal/puterr.c new file mode 100644 index 0000000000..f7d79e5f34 --- /dev/null +++ b/c/src/tests/sptests/spfatal/puterr.c @@ -0,0 +1,68 @@ +/* put_error + * + * This routine verifies that the given error is the expected error. + * + * Input parameters: + * error - actual error code + * expected - expected error code + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +char *Errors[] = { + "RTEMS_SUCCESSFUL", /* successful completion */ + "RTEMS_TASK_EXITTED", /* returned from a task */ + "RTEMS_MP_NOT_CONFIGURED", /* multiprocessing not configured */ + "RTEMS_INVALID_NAME", /* invalid object name */ + "RTEMS_INVALID_ID", /* invalid object id */ + "RTEMS_TOO_MANY", /* too many */ + "RTEMS_TIMEOUT", /* timed out waiting */ + "RTEMS_OBJECT_WAS_DELETED", /* object was deleted while waiting */ + "RTEMS_INVALID_SIZE", /* specified size was invalid */ + "RTEMS_INVALID_ADDRESS", /* address specified is invalid */ + "RTEMS_INVALID_NUMBER", /* number was invalid */ + "RTEMS_NOT_DEFINED", /* item has not been initialized */ + "RTEMS_RESOURCE_IN_USE", /* resources still outstanding */ + "RTEMS_UNSATISFIED", /* request not satisfied */ + "RTEMS_INCORRECT_STATE", /* task is in wrong state */ + "RTEMS_ALREADY_SUSPENDED", /* task already in state */ + "RTEMS_ILLEGAL_ON_SELF", /* illegal operation on calling task */ + "RTEMS_ILLEGAL_ON_REMOTE_OBJECT", /* illegal operation for remote object */ + "RTEMS_CALLED_FROM_ISR", /* called from ISR */ + "RTEMS_INVALID_PRIORITY", /* invalid task priority */ + "RTEMS_INVALID_CLOCK", /* invalid date/time */ + "RTEMS_INVALID_NODE", /* invalid node id */ + "RTEMS_NOT_OWNER_OF_RESOURCE", /* not owner of resource */ + "RTEMS_NOT_CONFIGURED", /* directive not configured */ + "RTEMS_NOT_IMPLEMENTED" /* directive not implemented */ +}; + +/* Task states */ + +void put_error( + rtems_unsigned32 error, + rtems_status_code expected +) +{ + + if ( error <= RTEMS_NOT_IMPLEMENTED ) + printf( "EXPECTED FATAL - error code is correctly %s\n", Errors[ error ] ); + else + printf( "ERROR - out of range error code is %d\n", error ); + + if ( error != expected ) { + printf( "ERROR - did not get expected code of %d\n", expected ); + } +} diff --git a/c/src/tests/sptests/spfatal/spfatal.doc b/c/src/tests/sptests/spfatal/spfatal.doc new file mode 100644 index 0000000000..501f278670 --- /dev/null +++ b/c/src/tests/sptests/spfatal/spfatal.doc @@ -0,0 +1,28 @@ +# +# $Id$ +# +# COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +# On-Line Applications Research Corporation (OAR). +# All rights assigned to U.S. Government, 1994. +# +# This material may be reproduced by or for the U.S. Government pursuant +# to the copyright license under the clause at DFARS 252.227-7013. This +# notice must appear in all copies of this file and its derivatives. +# + + +This file describes the directives and concepts tested by this test set. + +test set name: testfatal + +directives: none + +concepts: + + a. Verifies that the proper error is reported by k_fatal when a task + exits. + + b. Verifies that the task exitted extension works correctly. + + c. Verifies that the fatal error extension works corectly. + diff --git a/c/src/tests/sptests/spfatal/spfatal.scn b/c/src/tests/sptests/spfatal/spfatal.scn new file mode 100644 index 0000000000..ecb9f63597 --- /dev/null +++ b/c/src/tests/sptests/spfatal/spfatal.scn @@ -0,0 +1,8 @@ +*** TEST FATAL *** +EXPECTED FATAL - error code is correctly RTEMS_UNSATISFIED +EXPECTED FATAL - error code is correctly RTEMS_INVALID_ADDRESS +EXPECTED FATAL - error code is correctly RTEMS_UNSATISFIED +EXPECTED FATAL - error code is correctly RTEMS_INVALID_PRIORITY +EXPECTED FATAL - error code is correctly RTEMS_TASK_EXITTED +NOT TESTING FATAL ERROR WHEN TASK EXITS -- C LIBRARY CATCHES THIS +*** END OF TEST FATAL *** diff --git a/c/src/tests/sptests/spfatal/system.h b/c/src/tests/sptests/spfatal/system.h new file mode 100644 index 0000000000..aa2c6d17e4 --- /dev/null +++ b/c/src/tests/sptests/spfatal/system.h @@ -0,0 +1,30 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include "tmacros.h" + +/* Miscellaneous */ + +#define EXTERN extern /* external definition */ + +/* macros */ + +/* structures */ + +#include "gvar.h" + +/* end of include file */ diff --git a/c/src/tests/sptests/spfatal/task1.c b/c/src/tests/sptests/spfatal/task1.c new file mode 100644 index 0000000000..d06d25e690 --- /dev/null +++ b/c/src/tests/sptests/spfatal/task1.c @@ -0,0 +1,29 @@ +/* Task_1 + * + * This routine serves as a test task. It verifies the task manager. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "system.h" + +rtems_task Task_1( + rtems_task_argument argument +) +{ + puts( "\n\n*** TEST FATAL ***" ); + puts( "TA1 - exitting task" ); +} diff --git a/c/src/tests/sptests/spsize/getint.c b/c/src/tests/sptests/spsize/getint.c new file mode 100644 index 0000000000..43d1f695c9 --- /dev/null +++ b/c/src/tests/sptests/spsize/getint.c @@ -0,0 +1,32 @@ +/* getint + * + * This routine reads and returns an integer. + * It assumes decimal. + * + * Input parameters: NONE + * + * Output parameters: + * returns - number read + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include +#include +#include + +int getint( void ) +{ + char buff[16]; + + gets(buff); + return atoi(buff); +} diff --git a/c/src/tests/sptests/spsize/init.c b/c/src/tests/sptests/spsize/init.c new file mode 100644 index 0000000000..e15e7b40fb --- /dev/null +++ b/c/src/tests/sptests/spsize/init.c @@ -0,0 +1,58 @@ +/* Init + * + * This routine is the initialization task for this test program. + * It is a user initialization task and has the responsibility for creating + * and starting the tasks that make up the test. If the time of day + * clock is required for the test, it should also be set to a known + * value by this function. + * + * Input parameters: + * argument - task argument + * + * Output parameters: NONE + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include "apps.h" +#undef EXTERN +#define EXTERN +#include "conftbl.h" +#include "gvar.h" + +rtems_task Test_task(); +void size_rtems( int mode ); + +rtems_task Init( + rtems_task_argument argument +) +{ + int choice; + + setvbuf(stdout, 0, _IONBF, 0); + + do { + puts( "\n*** RTEMS SIZE PROGRAM ***" ); + printf( "\n\nPlease select program mode:\n" ); + printf( " 1) Print Formulas\n" ); + printf( " 2) Determine Workspace Size\n" ); + printf( " 3) Exit\n" ); + printf( "Enter number of choice (1,2,3) : " ); + + choice = getint(); + switch( choice ) { + case 1: size_rtems( 1 ); break; + case 2: size_rtems( 0 ); break; + case 3: exit( 0 ); + default: continue; + } + } while ( FOREVER ); +} diff --git a/c/src/tests/sptests/spsize/size.c b/c/src/tests/sptests/spsize/size.c new file mode 100644 index 0000000000..52404272fd --- /dev/null +++ b/c/src/tests/sptests/spsize/size.c @@ -0,0 +1,601 @@ +/* main + * + * This program is run to determine the data space and work space + * requirements of the current version of RTEMS. + * + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. + * On-Line Applications Research Corporation (OAR). + * All rights assigned to U.S. Government, 1994. + * + * This material may be reproduced by or for the U.S. Government pursuant + * to the copyright license under the clause at DFARS 252.227-7013. This + * notice must appear in all copies of this file and its derivatives. + * + * $Id$ + */ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* These are always defined by the executive. + * + * #include + * #include + * #include + */ +#define HEAP_OVHD 16 /* wasted heap space per task stack */ +#define NAME_PTR_SIZE 8 /* size of name and pointer table entries */ +#define READYCHAINS_SIZE \ + ((RTEMS_MAXIMUM_PRIORITY + 1) * sizeof(Chain_Control )) + +#define PER_TASK \ + (sizeof (Thread_Control) + NAME_PTR_SIZE + HEAP_OVHD) +#define PER_SEMAPHORE \ + (sizeof (Semaphore_Control) + NAME_PTR_SIZE) +#define PER_TIMER \ + (sizeof (Timer_Control) + NAME_PTR_SIZE) +#define PER_MSGQ \ + (sizeof (Message_queue_Control) + NAME_PTR_SIZE) +#define PER_MSG \ + (sizeof (Message_queue_Buffer_control)) +#define PER_REGN \ + (sizeof (Region_Control) + NAME_PTR_SIZE) +#define PER_PART \ + (sizeof (Partition_Control) + NAME_PTR_SIZE) +#define PER_PERIOD \ + (sizeof (Rate_monotonic_Control) + NAME_PTR_SIZE) +#define PER_PORT \ + (sizeof (Dual_ported_memory_Control) + NAME_PTR_SIZE) +#define PER_EXTENSION \ + (sizeof (Extension_Control) + NAME_PTR_SIZE) + +#define PER_DRV (0) +#define PER_FPTASK (CONTEXT_FP_SIZE) +#define PER_GOBTBL (sizeof (Chain_Control)*4) +#define PER_NODE PER_GOBTBL +#define PER_GOBJECT (sizeof (Objects_MP_Control)) +#define PER_PROXY (sizeof (Thread_Proxy_control)) + +#if (CPU_ALL_TASKS_ARE_FP == TRUE) +#define SYSTEM_INITIALIZATION_FP (sizeof( Context_Control_fp )) +#else +#define SYSTEM_INITIALIZATION_FP 0 +#endif + +#if (CPU_IDLE_TASK_IS_FP == TRUE) +#define SYSTEM_IDLE_FP (sizeof( Context_Control_fp )) +#else +#define SYSTEM_IDLE_FP 0 +#endif + +#define SYSTEM_TASKS \ + (INTERNAL_THREADS_IDLE_THREAD_STACK_SIZE + \ + INTERNAL_THREADS_SYSTEM_INITIALIZATION_THREAD_STACK_SIZE + \ + (2*sizeof(Thread_Control))) + \ + SYSTEM_INITIALIZATION_FP + \ + SYSTEM_IDLE_FP + +#define rtems_unsigned32 unsigned32 + +rtems_unsigned32 sys_req; + +/* to avoid warnings */ +int puts(); +int printf(); +int getint(); +#undef getchar +int getchar(); +void help_size(); +void print_formula(); + +void size_rtems( + int mode +) +{ +int uninitialized = 0; +int initialized = 0; + +/* + * The following data is allocated for each Manager: + * + * + Per Manager Object Information + * - local pointer table + * - local name table + * - the object's control blocks + * - global name chains + * + * The following is the data allocate from the RTEMS Workspace Area. + * The order indicates the order in which RTEMS allocates it. + * + * + Object MP + * - Global Object CB's + * + Thread + * - Ready Chain + * + Thread MP + * - Proxies Chain + * + Interrupt Manager + * - Interrupt Stack + * + Timer Manager + * - per Manager Object Data + * + Extension Manager + * - per Manager Object Data + * + Message Queue Manager + * - per Manager Object Data + * - Message Buffers + * + Semaphore Manager + * - per Manager Object Data + * + Partition Manager + * - per Manager Object Data + * + Region Manager + * - per Manager Object Data + * + Dual Ported Memory Manager + * - per Manager Object Data + * + Rate Monotonic Manager + * - per Manager Object Data + * + Internal Threads Handler + * - SYSI Thread TCB + * - IDLE Thread TCB + * - SYSI Thread stack + * - SYSI Thread FP area (if CPU requires this) + * - IDLE Thread stack + * - IDLE Thread FP area (if CPU requires this) + * + * This does not take into account any CPU dependent alignment requirements. + * + * The following calculates the overhead needed by RTEMS from the + * Workspace Area. + */ +sys_req = SYSTEM_TASKS + /* SYSI and IDLE */ + NAME_PTR_SIZE + /* Task Overhead */ + READYCHAINS_SIZE + /* Ready Chains */ + NAME_PTR_SIZE + /* Timer Overhead */ + NAME_PTR_SIZE + /* Semaphore Overhead */ + NAME_PTR_SIZE + /* Message Queue Overhead */ + NAME_PTR_SIZE + /* Region Overhead */ + NAME_PTR_SIZE + /* Partition Overhead */ + NAME_PTR_SIZE + /* Dual-Ported Memory Overhead */ + NAME_PTR_SIZE + /* Rate Monotonic Overhead */ + NAME_PTR_SIZE + /* Extension Overhead */ + PER_NODE; /* Extra Gobject Table */ + +uninitialized = +/*address.h*/ 0 + + +/*asr.h*/ 0 + + +/*attr.h*/ 0 + + +/*bitfield.h*/ 0 + + +/*chain.h*/ 0 + + +/*clock.h*/ 0 + + +/*config.h*/ (sizeof _Configuration_Table) + + (sizeof _Configuration_MP_table) + + (sizeof _Configuration_MPCI_table) + + +/*context.h*/ (sizeof _Context_Switch_necessary) + + +/*copyrt.h*/ 0 + + +/*dpmem.h*/ (sizeof _Dual_ported_memory_Information) + + +/*event.h*/ (sizeof _Event_Sync) + + +/*eventmp.h*/ 0 + + +/*eventset.h*/ 0 + + +/*extension.h*/ (sizeof _Extension_Information) + + +/*fatal.h*/ 0 + + +/*heap.h*/ 0 + + +/*init.h*/ 0 + + +/*inthrdmp.h*/ 0 + + +/*intr.h*/ 0 + + +/*intthrd.h*/ (sizeof _Internal_threads_System_initialization_thread) + + (sizeof _Internal_threads_Idle_thread) + + (sizeof _Internal_threads_MP_Receive_server_entry) + + +/*io.h*/ (sizeof _IO_Number_of_drivers) + + (sizeof _IO_Driver_address_table) + + +/*isr.h*/ (sizeof _ISR_Nest_level) + + (sizeof _ISR_Vector_table) + + (sizeof _ISR_Signals_to_thread_executing) + + +/*message.h*/ (sizeof _Message_queue_Inactive_messages) + + (sizeof _Message_queue_Information) + + +/*modes.h*/ 0 + + +/*mp.h*/ 0 + + +/*mpci.h*/ (sizeof _MPCI_Remote_blocked_threads) + + +/*mppkt.h*/ 0 + + +/*mptables.h*/ 0 + + +/*msgmp.h*/ 0 + + +/*object.h*/ (sizeof _Objects_Local_node) + + +/*objectmp.h*/ (sizeof _Objects_MP_Inactive_global_objects) + + +/*options.h*/ 0 + + +/*part.h*/ (sizeof _Partition_Information) + + +/*partmp.h*/ 0 + + +/*priority.h*/ (sizeof _Priority_Major_bit_map) + + (sizeof _Priority_Bit_map) + + +/*ratemon.h*/ (sizeof _Rate_monotonic_Information) + + +/*region.h*/ (sizeof _Region_Information) + + +/*regionmp.h*/ 0 + + +/*rtems.h*/ /* Not applicable */ + +/*sem.h*/ (sizeof _Semaphore_Information) + + +/*semmp.h*/ 0 + + +/*signal.h*/ 0 + + +/*signalmp.h*/ 0 + + +/*stack.h*/ 0 + + +/*states.h*/ 0 + + +/*status.h*/ 0 + + +/*system.h*/ (sizeof _CPU_Table) + + +/*sysstate.h*/ (sizeof _System_state_Current) + + +/*taskmp.h*/ 0 + + +/*tasks.h*/ 0 + + +/*thread.h*/ (sizeof _Thread_Dispatch_disable_level) + + (sizeof _Thread_Ticks_remaining_in_timeslice) + + (sizeof _Thread_Ticks_per_timeslice) + + (sizeof _Thread_Ready_chain) + + (sizeof _Thread_Executing) + + (sizeof _Thread_Heir) + + (sizeof _Thread_Allocated_fp) + + (sizeof _Thread_Information) + + (sizeof _Thread_BSP_context) + + +/*threadmp.h*/ (sizeof _Thread_MP_Receive) + + (sizeof _Thread_MP_Active_proxies) + + (sizeof _Thread_MP_Inactive_proxies) + + +/*threadq.h*/ 0 + + +/*timer.h*/ (sizeof _Timer_Information) + + +/*tod.h*/ (sizeof _TOD_Current) + + (sizeof _TOD_Seconds_since_epoch) + + (sizeof _TOD_Ticks_since_boot) + + (sizeof _TOD_Microseconds_per_tick) + + (sizeof _TOD_Ticks_per_second) + + (sizeof _TOD_Seconds_watchdog) + + +/*tqdata.h*/ 0 + + +/*types.h*/ 0 + + +/*userext.h*/ (sizeof _User_extensions_Initial) + + (sizeof _User_extensions_List) + + +/*watchdog.h*/ (sizeof _Watchdog_Ticks_chain) + + (sizeof _Watchdog_Seconds_chain) + + (sizeof _Watchdog_Sync) + + +/*wkspace.h*/ (sizeof _Workspace_Area); + +uninitialized = 0; + +#ifdef i386 + +/* cpu.h */ +uninitialized += (sizeof _CPU_Null_fp_context) + + (sizeof _CPU_Interrupt_stack_low) + + (sizeof _CPU_Interrupt_stack_high); + +#endif + +#ifdef i960 + +/* cpu.h */ +uninitialized += (sizeof _CPU_Interrupt_stack_low) + + (sizeof _CPU_Interrupt_stack_high); + +#endif + +#ifdef hppa1_1 + +/* cpu.h */ +uninitialized += (sizeof _CPU_Null_fp_context) + + (sizeof _CPU_Default_gr27) + + (sizeof _CPU_Interrupt_stack_low) + + (sizeof _CPU_Interrupt_stack_high); +#endif + +#ifdef m68k + +/* cpu.h */ +uninitialized += (sizeof _CPU_Interrupt_stack_low) + + (sizeof _CPU_Interrupt_stack_high); + +#endif + +#ifdef no_cpu + +/* cpu.h */ +uninitialized += (sizeof _CPU_Null_fp_context) + + (sizeof _CPU_Interrupt_stack_low) + + (sizeof _CPU_Interrupt_stack_high) + + (sizeof _CPU_Thread_dispatch_pointer); + +#endif + +initialized += +/*copyrt.h*/ (strlen(_Copyright_Notice)+1) + + +/*sptables.h*/ (sizeof _Configuration_Default_multiprocessing_table) + + (strlen(_RTEMS_version)+1) + + (sizeof _Entry_points) + + + +/*tod.h*/ (sizeof _TOD_Days_per_month) + + (sizeof _TOD_Days_to_date) + + (sizeof _TOD_Days_since_last_leap_year); + +puts( "" ); +#ifdef i960CA + print_formula(); +#else + if ( mode == 0 ) help_size(); + else print_formula(); +#endif + +printf( "\n" ); +printf( "RTEMS uninitialized data consumes %d bytes\n", uninitialized ); +printf( "RTEMS intialized data consumes %d bytes\n", initialized ); + +} + +void help_size() +{ +int c = '\0'; +int break_loop; +int total_size; +int task_stacks; +int interrupt_stack; +int maximum_tasks, size_tasks; +int maximum_sems, size_sems; +int maximum_timers, size_timers; +int maximum_msgqs, size_msgqs; +int maximum_msgs, size_msgs; +int maximum_regns, size_regns; +int maximum_parts, size_parts; +int maximum_ports, size_ports; +int maximum_periods, size_periods; +int maximum_extensions, size_extensions; +int maximum_drvs, size_drvs; +int maximum_fps, size_fps; +int maximum_nodes, size_nodes; +int maximum_gobjs, size_gobjs; +int maximum_proxies, size_proxies; + +total_size = sys_req; /* Fixed Overhead */ +printf( "What is maximum_tasks? " ); +maximum_tasks = getint(); +size_tasks = PER_TASK * maximum_tasks; +total_size += size_tasks; + +printf( "What is maximum_semaphores? " ); +maximum_sems = getint(); +size_sems = PER_SEMAPHORE * maximum_sems; +total_size += size_sems; + +printf( "What is maximum_timers? " ); +maximum_timers = getint(); +size_timers = PER_TIMER * maximum_timers; +total_size += size_timers; + +printf( "What is maximum_message_queues? " ); +maximum_msgqs = getint(); +size_msgqs = PER_MSGQ * maximum_msgqs; +total_size += size_msgqs; + +printf( "What is maximum_messages? " ); +maximum_msgs = getint(); +size_msgs = PER_MSG * maximum_msgs; +total_size += size_msgs; + +printf( "What is maximum_regions? " ); +maximum_regns = getint(); +size_regns = PER_REGN * maximum_regns; +total_size += size_regns; + +printf( "What is maximum_partitions? " ); +maximum_parts = getint(); +size_parts = PER_PART * maximum_parts; +total_size += size_parts; + +printf( "What is maximum_ports? " ); +maximum_ports = getint(); +size_ports = PER_PORT * maximum_ports; +total_size += size_ports; + +printf( "What is maximum_periods? " ); +maximum_periods = getint(); +size_periods = PER_PORT * maximum_periods; +total_size += size_periods; + +printf( "What is maximum_extensions? " ); +maximum_extensions = getint(); +size_extensions = PER_EXTENSION * maximum_extensions; +total_size += size_extensions; + +printf( "What is number_of_device_drivers? " ); +maximum_drvs = getint(); +size_drvs = PER_DRV * maximum_drvs; +total_size += size_drvs; + +printf( "What will be total stack requirement for all tasks? " ); +task_stacks = getint(); +total_size += task_stacks; + +printf( "What is the size of the interrupt stack? " ); +interrupt_stack = getint(); +total_size += interrupt_stack; + +printf( "How many tasks will be created with the FP flag? " ); +maximum_fps = getint(); +size_fps = PER_FPTASK * maximum_fps; +total_size += size_fps; + +printf( "Is this a single processor system? " ); +for ( break_loop=0 ; !break_loop; c = getchar() ) { + switch ( c ) { + case 'Y': case 'y': + case 'N': case 'n': + break_loop = 1; + break; + } +} +printf( "%c\n", c ); +if ( c == 'n' || c == 'N' ) { + printf( "What is maximum_nodes? " ); + maximum_nodes = getint(); + size_nodes = PER_NODE * maximum_nodes; + total_size += size_nodes; + printf( "What is maximum_global_objects? " ); + maximum_gobjs = getint(); + size_gobjs = PER_GOBJECT * maximum_gobjs; + total_size += size_gobjs; + printf( "What is maximum_proxies? " ); + maximum_proxies = getint(); + size_proxies = PER_PROXY * maximum_proxies; + total_size += size_proxies; +} else { + maximum_nodes = 0; + size_nodes = PER_NODE * 0; + maximum_gobjs = 0; + size_gobjs = PER_GOBJECT * 0; + maximum_proxies = 0; + size_proxies = PER_PROXY * 0; +} + +printf( "\n\n" ); +printf( " ************** EXECUTIVE WORK SPACE REQUIRED **************\n" ); +printf( " Tasks - %03d * %03d = %d\n", + maximum_tasks, PER_TASK, size_tasks ); +printf( " Semaphores - %03d * %03d = %d\n", + maximum_sems, PER_SEMAPHORE, size_sems ); +printf( " Timers - %03d * %03d = %d\n", + maximum_timers, PER_TIMER, size_timers ); +printf( " Msg Queues - %03d * %03d = %d\n", + maximum_msgqs, PER_MSGQ, size_msgqs ); +printf( " Messages - %03d * %03d = %d\n", + maximum_msgs, PER_MSG, size_msgs ); +printf( " Regions - %03d * %03d = %d\n", + maximum_regns, PER_REGN, size_regns); +printf( " Partitions - %03d * %03d = %d\n", + maximum_parts, PER_PART, size_parts ); +printf( " Periods - %03d * %03d = %d\n", + maximum_periods, PER_PERIOD, size_periods ); +printf( " Extensions - %03d * %03d = %d\n", + maximum_extensions, PER_EXTENSION, size_extensions ); +printf( " Device Drivers - %03d * %03d = %d\n", + maximum_drvs, PER_DRV, size_drvs ); + +printf( " System Requirements - %04d = %d\n", + sys_req, sys_req ); + +printf( " Floating Point Tasks - %03d * %03d = %d\n", + maximum_fps, PER_FPTASK, size_fps ); +printf( " Application Task Stacks - = %d\n", + task_stacks ); +printf( " Interrupt Stacks - = %d\n", + task_stacks ); +printf( " \n" ); +printf( " Global object tables - %03d * %03d = %d\n", + maximum_nodes, PER_NODE, size_nodes ); +printf( " Global objects - %03d * %03d = %d\n", + maximum_gobjs, PER_GOBJECT, size_gobjs ); +printf( " Proxies - %03d * %03d = %d\n", + maximum_proxies, PER_PROXY, size_proxies ); +printf( "\n\n" ); +printf( " TOTAL = %d bytes\n", + total_size ); +} + +void print_formula() +{ +printf( " ************** EXECUTIVE WORK SPACE FORMULA **************\n" ); +printf( " Tasks - maximum_tasks * %d\n", PER_TASK ); +printf( " Timers - maximum_timers * %d\n", PER_TIMER ); +printf( " Semaphores - maximum_semaphores * %d\n", PER_SEMAPHORE); +printf( " Message Queues - maximum_message_queues * %d\n", PER_MSGQ ); +printf( " Messages - maximum_messages * %d\n", PER_MSG ); +printf( " Regions - maximum_regions * %d\n", PER_REGN ); +printf( " Partitions - maximum_partitions * %d\n", PER_PART ); +printf( " Ports - maximum_ports * %d\n", PER_PORT ); +printf( " Periods - maximum_periods * %d\n", PER_PORT ); +printf( " Extensions - maximum_extensions * %d\n", PER_EXTENSION ); +printf( " Device Drivers - number_of_device_drivers * %d\n", PER_DRV); +printf( " System Requirements - %d\n", sys_req ); +printf( " Floating Point Tasks - FPMASK Tasks * %d\n", CONTEXT_FP_SIZE ); +printf( " User's Tasks' Stacks -\n" ); +printf( " Interrupt Stack -\n" ); +printf( " \n" ); +printf( " Global object tables - maximum_nodes * %d\n", PER_NODE ); +printf( " Global objects - maximum_global_objects * %d\n", PER_GOBJECT ); +printf( " Proxies - maximum_proxies * %d\n", PER_PROXY ); +} -- cgit v1.2.3