diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 1997-06-02 20:19:03 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 1997-06-02 20:19:03 +0000 |
commit | 6d4e604be8b43c0555cd1c9531fe78ae199a1189 (patch) | |
tree | adc303bfeaddf541a8f45ea1597f43bf8bf7a09d /c/src/ada-tests/mptests | |
parent | Changed bitwise OR's used to build up option and attribute sets (diff) | |
download | rtems-6d4e604be8b43c0555cd1c9531fe78ae199a1189.tar.bz2 |
Initial revision
Diffstat (limited to 'c/src/ada-tests/mptests')
56 files changed, 8114 insertions, 0 deletions
diff --git a/c/src/ada-tests/mptests/mp01/mptest.adb b/c/src/ada-tests/mptests/mp01/mptest.adb new file mode 100644 index 0000000000..6d0f1ab3bb --- /dev/null +++ b/c/src/ada-tests/mptests/mp01/mptest.adb @@ -0,0 +1,235 @@ +-- +-- MPTEST / BODY +-- +-- DESCRIPTION: +-- +-- This package is the implementation for Test 1 of the RTEMS +-- Multiprocessor Test Suite. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest.adb,v 1.3 1995/07/12 19:38:33 joel Exp +-- + +with INTERFACES; use INTERFACES; +with RTEMS; +with TEST_SUPPORT; +with TEXT_IO; +with UNSIGNED32_IO; + +package body MPTEST is + + package body PER_NODE_CONFIGURATION is separate; + +--PAGE +-- +-- INIT +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ) is + C : RTEMS.CHARACTER; + TIME : RTEMS.TIME_OF_DAY; + STATUS : RTEMS.STATUS_CODES; + begin + + TEXT_IO.NEW_LINE( 2 ); + TEXT_IO.PUT( "*** TEST 1 -- NODE " ); + UNSIGNED32_IO.PUT( + MPTEST.MULTIPROCESSING_CONFIGURATION.NODE, + WIDTH => 1 + ); + TEXT_IO.PUT_LINE( " ***" ); + + if MPTEST.MULTIPROCESSING_CONFIGURATION.NODE /= 1 then + C := 'S'; + else + C := 'M'; + end if; + + MPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( C, 'A', '1', ' ' ); + MPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( C, 'A', '2', ' ' ); + MPTEST.TASK_NAME( 3 ) := RTEMS.BUILD_NAME( C, 'A', '3', ' ' ); + + TIME := ( 1988, 12, 31, 9, 0, 0, 0 ); + + RTEMS.CLOCK_SET( TIME, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_SET" ); + + TEXT_IO.PUT_LINE( "Creating task 1 (Global)" ); + + RTEMS.TASK_CREATE( + MPTEST.TASK_NAME( 1 ), + 1, + 2048, + RTEMS.DEFAULT_MODES, + RTEMS.GLOBAL, + MPTEST.TASK_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA1" ); + + TEXT_IO.PUT_LINE( "Creating task 2 (Global)" ); + + RTEMS.TASK_CREATE( + MPTEST.TASK_NAME( 2 ), + 1, + 2048, + RTEMS.TIMESLICE, + RTEMS.GLOBAL, + MPTEST.TASK_ID( 2 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA2" ); + + TEXT_IO.PUT_LINE( "Creating task 3 (Local)" ); + + RTEMS.TASK_CREATE( + MPTEST.TASK_NAME( 3 ), + 1, + 2048, + RTEMS.DEFAULT_MODES, + RTEMS.DEFAULT_ATTRIBUTES, + MPTEST.TASK_ID( 3 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA3" ); + + RTEMS.TASK_START( + MPTEST.TASK_ID( 1 ), + MPTEST.TEST_TASK'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA1" ); + + RTEMS.TASK_START( + MPTEST.TASK_ID( 2 ), + MPTEST.TEST_TASK'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA2" ); + + RTEMS.TASK_START( + MPTEST.TASK_ID( 3 ), + MPTEST.TEST_TASK'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA3" ); + + RTEMS.TASK_DELETE( RTEMS.SELF, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" ); + + end INIT; + +--PAGE +-- +-- TEST_TASK +-- + + procedure TEST_TASK ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ) is + TIME : RTEMS.TIME_OF_DAY; + TID : RTEMS.ID; + STATUS : RTEMS.STATUS_CODES; + begin + + RTEMS.TASK_IDENT( RTEMS.SELF, RTEMS.SEARCH_ALL_NODES, TID, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_IDENT OF SELF" ); + + RTEMS.CLOCK_GET( RTEMS.CLOCK_GET_TOD, TIME'ADDRESS, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_GET" ); + + TEST_SUPPORT.PUT_NAME( + MPTEST.TASK_NAME( TEST_SUPPORT.TASK_NUMBER( TID ) ), + FALSE + ); + + TEST_SUPPORT.PRINT_TIME( "- clock_get - ", TIME, "" ); + TEXT_IO.NEW_LINE; + + RTEMS.TASK_WAKE_AFTER( + TEST_SUPPORT.TASK_NUMBER( TID ) * 5 * + TEST_SUPPORT.TICKS_PER_SECOND, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + RTEMS.CLOCK_GET( RTEMS.CLOCK_GET_TOD, TIME'ADDRESS, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "CLOCK_GET" ); + + TEST_SUPPORT.PUT_NAME( + MPTEST.TASK_NAME( TEST_SUPPORT.TASK_NUMBER( TID ) ), + FALSE + ); + + TEST_SUPPORT.PRINT_TIME( "- clock_get - ", TIME, "" ); + TEXT_IO.NEW_LINE; + + if TEST_SUPPORT.TASK_NUMBER( TID ) = 1 then -- TASK 1 + + TEST_SUPPORT.PUT_NAME( + MPTEST.TASK_NAME( TEST_SUPPORT.TASK_NUMBER( TID ) ), + FALSE + ); + + TEXT_IO.PUT_LINE( " - deleting self" ); + + RTEMS.TASK_DELETE( RTEMS.SELF, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" ); + + else if TEST_SUPPORT.TASK_NUMBER( TID ) = 2 then -- TASK 2 + + TEST_SUPPORT.PUT_NAME( MPTEST.TASK_NAME( 2 ), FALSE ); + TEXT_IO.PUT( " - waiting to be deleted by " ); + TEST_SUPPORT.PUT_NAME( MPTEST.TASK_NAME( 3 ), TRUE ); + + loop + TEST_SUPPORT.DO_NOTHING; -- can't be optimized away + end loop; + + else -- TASK 3 + + TEST_SUPPORT.PUT_NAME( MPTEST.TASK_NAME( 3 ), FALSE ); + TEXT_IO.PUT( " - getting TID of " ); + TEST_SUPPORT.PUT_NAME( MPTEST.TASK_NAME( 2 ), TRUE ); + + RTEMS.TASK_IDENT( + MPTEST.TASK_NAME( 2 ), + RTEMS.SEARCH_ALL_NODES, + TID, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_IDENT OF TA2" ); + + TEST_SUPPORT.PUT_NAME( MPTEST.TASK_NAME( 3 ), FALSE ); + TEXT_IO.PUT( " - deleting " ); + TEST_SUPPORT.PUT_NAME( MPTEST.TASK_NAME( 2 ), TRUE ); + + RTEMS.TASK_DELETE( TID, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF TA2" ); + + end if; + end if; + + TEXT_IO.PUT_LINE( "*** END OF TEST 1 ***" ); + + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end TEST_TASK; + +end MPTEST; diff --git a/c/src/ada-tests/mptests/mp01/mptest.ads b/c/src/ada-tests/mptests/mp01/mptest.ads new file mode 100644 index 0000000000..f19397445f --- /dev/null +++ b/c/src/ada-tests/mptests/mp01/mptest.ads @@ -0,0 +1,165 @@ +-- +-- MPTEST / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package is the specification for Test 1 of the RTEMS +-- Multiprocessor Test Suite. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest.ads,v 1.3 1995/07/12 19:38:34 joel Exp +-- + +with CLOCK_DRIVER; +with BSP_MPCI; +with RTEMS; + +package MPTEST is + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS tasks created +-- by this test. +-- + + TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.ID; + TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.NAME; + +-- +-- INIT +-- +-- DESCRIPTION: +-- +-- This RTEMS task initializes the application. +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ); + +-- +-- TEST_TASK +-- +-- DESCRIPTION: +-- +-- This is the body of the RTEMS tasks which constitute this test. +-- + + procedure TEST_TASK ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ); + +-- +-- This is the Driver Address Table for this test. +-- + + DEVICE_DRIVERS : aliased RTEMS.DRIVER_ADDRESS_TABLE( 1 .. 1 ) := + (1=> + ( + CLOCK_DRIVER.INITIALIZE'ACCESS, -- Initialization + RTEMS.NO_DRIVER_ENTRY, -- Open + RTEMS.NO_DRIVER_ENTRY, -- Close + RTEMS.NO_DRIVER_ENTRY, -- Read + RTEMS.NO_DRIVER_ENTRY, -- Write + RTEMS.NO_DRIVER_ENTRY -- Control + ) + ); + +-- +-- This is the Initialization Tasks Table for this test. +-- + + INITIALIZATION_TASKS : aliased RTEMS.INITIALIZATION_TASKS_TABLE( 1 .. 1 ) := + (1=> + ( + RTEMS.BUILD_NAME( 'U', 'I', '1', ' ' ), -- task name + 2048, -- stack size + 1, -- priority + RTEMS.GLOBAL, -- attributes + MPTEST.INIT'ACCESS, -- entry point + RTEMS.NO_PREEMPT, -- initial mode + 0 -- argument list + ) + ); + +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- +-- BEGIN SUBPACKAGE -- +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- + + -- + -- MPTEST.PER_NODE_CONFIGURATION / SPECIFICATION + -- + -- DESCRIPTION: + -- + -- This package is the specification for the subpackage + -- which will define the per node configuration parameters. + -- + + package PER_NODE_CONFIGURATION is + + -- + -- LOCAL_NODE_NUMBER + -- + -- DESCRIPTION: + -- + -- This function returns the node number for this node. + -- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32; + + pragma INLINE ( LOCAL_NODE_NUMBER ); + + end PER_NODE_CONFIGURATION; + +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- +-- END SUBPACKAGE -- +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- + +-- +-- This is the Multiprocessor Configuration Table for this test. +-- + + MULTIPROCESSING_CONFIGURATION : aliased RTEMS.MULTIPROCESSING_TABLE := ( + MPTEST.PER_NODE_CONFIGURATION.LOCAL_NODE_NUMBER, + 2, -- maximum # nodes in system + 33, -- maximum # global objects + 33 -- maximum # proxies + ); + +-- +-- This is the Configuration Table for this test. +-- + + CONFIGURATION : aliased RTEMS.CONFIGURATION_TABLE := ( + RTEMS.NULL_ADDRESS, -- will be replaced by BSP + 64 * 1024, -- executive RAM size + 10, -- maximum # tasks + 0, -- maximum # timers + 0, -- maximum # semaphores + 0, -- maximum # message queues + 0, -- maximum # messages + 0, -- maximum # partitions + 0, -- maximum # regions + 0, -- maximum # dp memory areas + 0, -- maximum # periods + 0, -- maximum # user extensions + RTEMS.MILLISECONDS_TO_MICROSECONDS(10), -- # us in a tick + 50 -- # ticks in a timeslice + ); + +end MPTEST; diff --git a/c/src/ada-tests/mptests/mp01/node1/mptest-per_node_configuration.adb b/c/src/ada-tests/mptests/mp01/node1/mptest-per_node_configuration.adb new file mode 100644 index 0000000000..33eca27654 --- /dev/null +++ b/c/src/ada-tests/mptests/mp01/node1/mptest-per_node_configuration.adb @@ -0,0 +1,43 @@ +-- +-- MPTEST.PER_NODE_CONFIGURATION / BODY +-- +-- DESCRIPTION: +-- +-- This package is the specification for the subpackage +-- which will define the per node configuration parameters. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest-per_node_configuration.adb,v 1.2 1995/05/31 16:32:29 joel Exp +-- + +with RTEMS; + +separate ( MPTEST ) + +package body PER_NODE_CONFIGURATION is + +--PAGE +-- +-- LOCAL_NODE_NUMBER +-- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32 is + begin + + return 1; + + end LOCAL_NODE_NUMBER; + +end PER_NODE_CONFIGURATION; diff --git a/c/src/ada-tests/mptests/mp01/node2/mptest-per_node_configuration.adb b/c/src/ada-tests/mptests/mp01/node2/mptest-per_node_configuration.adb new file mode 100644 index 0000000000..c998792efd --- /dev/null +++ b/c/src/ada-tests/mptests/mp01/node2/mptest-per_node_configuration.adb @@ -0,0 +1,43 @@ +-- +-- MPTEST.PER_NODE_CONFIGURATION / BODY +-- +-- DESCRIPTION: +-- +-- This package is the specification for the subpackage +-- which will define the per node configuration parameters. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest-per_node_configuration.adb,v 1.2 1995/05/31 16:32:41 joel Exp +-- + +with RTEMS; + +separate ( MPTEST ) + +package body PER_NODE_CONFIGURATION is + +--PAGE +-- +-- LOCAL_NODE_NUMBER +-- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32 is + begin + + return 2; + + end LOCAL_NODE_NUMBER; + +end PER_NODE_CONFIGURATION; diff --git a/c/src/ada-tests/mptests/mp02/mptest.adb b/c/src/ada-tests/mptests/mp02/mptest.adb new file mode 100644 index 0000000000..0307c3c20b --- /dev/null +++ b/c/src/ada-tests/mptests/mp02/mptest.adb @@ -0,0 +1,213 @@ +-- +-- MPTEST / BODY +-- +-- DESCRIPTION: +-- +-- This package is the implementation for Test 2 of the RTEMS +-- Multiprocessor Test Suite. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest.adb,v 1.3 1995/07/12 19:38:41 joel Exp +-- + +with INTERFACES; use INTERFACES; +with RTEMS; +with TEST_SUPPORT; +with TEXT_IO; +with UNSIGNED32_IO; + +package body MPTEST is + + package body PER_NODE_CONFIGURATION is separate; + +--PAGE +-- +-- INIT +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ) is + STATUS : RTEMS.STATUS_CODES; + begin + + TEXT_IO.NEW_LINE( 2 ); + TEXT_IO.PUT( "*** TEST 2 -- NODE " ); + UNSIGNED32_IO.PUT( + MPTEST.MULTIPROCESSING_CONFIGURATION.NODE, + WIDTH => 1 + ); + TEXT_IO.PUT_LINE( " ***" ); + + MPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( '1', '1', '1', ' ' ); + MPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( '2', '2', '2', ' ' ); + + TEXT_IO.PUT_LINE( "Creating test task (Global)" ); + + RTEMS.TASK_CREATE( + MPTEST.TASK_NAME( MPTEST.MULTIPROCESSING_CONFIGURATION.NODE ), + 1, + 2048, + RTEMS.NO_PREEMPT, + RTEMS.GLOBAL, + MPTEST.TASK_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" ); + + RTEMS.TASK_START( + MPTEST.TASK_ID( 1 ), + MPTEST.TEST_TASK'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" ); + + RTEMS.TASK_DELETE( RTEMS.SELF, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" ); + + end INIT; + +--PAGE +-- +-- TEST_TASK +-- + + procedure TEST_TASK ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ) is + TID : RTEMS.ID; + TEST_TID : RTEMS.ID; + REMOTE_TID : RTEMS.ID; + REMOTE_NODE : RTEMS.UNSIGNED32; + NOTE : RTEMS.UNSIGNED32; + STATUS : RTEMS.STATUS_CODES; + begin + + RTEMS.TASK_IDENT( RTEMS.SELF, RTEMS.SEARCH_ALL_NODES, TID, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_IDENT OF SELF" ); + + if MPTEST.MULTIPROCESSING_CONFIGURATION.NODE = 1 then + REMOTE_NODE := 2; + else + REMOTE_NODE := 1; + end if; + + TEXT_IO.PUT_LINE( "Getting TID of remote task (all nodes)" ); + + loop + + RTEMS.TASK_IDENT( + MPTEST.TASK_NAME( REMOTE_NODE ), + RTEMS.SEARCH_ALL_NODES, + REMOTE_TID, + STATUS + ); + + exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS ); + + end loop; + + -- + -- We just got this ID above so looping is not necessary. + -- + + TEXT_IO.PUT_LINE( "Getting TID of remote task (1 node)" ); + RTEMS.TASK_IDENT( + MPTEST.TASK_NAME( REMOTE_NODE ), + REMOTE_NODE, + TEST_TID, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_IDENT" ); + + if TEST_TID /= REMOTE_TID then + TEXT_IO.PUT_LINE( "task_ident tid's do not match!!" ); + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + end if; + + RTEMS.TASK_DELETE( REMOTE_TID, STATUS ); + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.ILLEGAL_ON_REMOTE_OBJECT, + "task_delete of remote task" + ); + TEXT_IO.PUT_LINE( + "task_delete of remote task returned the correct error" + ); + + RTEMS.TASK_START( REMOTE_TID, MPTEST.TEST_TASK'ACCESS, 0, STATUS ); + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.ILLEGAL_ON_REMOTE_OBJECT, + "task_start of remote task" + ); + TEXT_IO.PUT_LINE( + "task_start of remote task returned the correct error" + ); + + RTEMS.TASK_RESTART( REMOTE_TID, 0, STATUS ); + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.ILLEGAL_ON_REMOTE_OBJECT, + "task_restart of remote task" + ); + TEXT_IO.PUT_LINE( + "task_restart of remote task returned the correct error" + ); + + + TEXT_IO.PUT( "Setting notepad " ); + UNSIGNED32_IO.PUT( RTEMS.GET_NODE( TID ), WIDTH=>1 ); + TEXT_IO.PUT( " of the remote task to " ); + UNSIGNED32_IO.PUT( RTEMS.GET_NODE( TID ), WIDTH=>1 ); + TEXT_IO.NEW_LINE; + RTEMS.TASK_SET_NOTE( + REMOTE_TID, + RTEMS.GET_NODE( TID ), + RTEMS.GET_NODE( TID ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SET_NOTE" ); + + TEXT_IO.PUT_LINE( "Getting a notepad of the remote task" ); + RTEMS.TASK_GET_NOTE( + REMOTE_TID, + RTEMS.GET_NODE( TID ), + NOTE, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_GET_NOTE" ); + + if NOTE = RTEMS.GET_NODE( TID ) then + TEXT_IO.PUT_LINE( "Remote notepad set and read correctly" ); + else + TEXT_IO.PUT( + "FAILURE!!! Remote notepad was not set and read correctly (" + ); + UNSIGNED32_IO.PUT( NOTE ); + TEXT_IO.PUT( ", " ); + UNSIGNED32_IO.PUT( RTEMS.GET_NODE( TID ) ); + TEXT_IO.PUT_LINE( ")" ); + + end if; + + RTEMS.TASK_DELETE( REMOTE_TID, STATUS ); + TEXT_IO.PUT_LINE( "*** END OF TEST 2 ***" ); + + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end TEST_TASK; + +end MPTEST; diff --git a/c/src/ada-tests/mptests/mp02/mptest.ads b/c/src/ada-tests/mptests/mp02/mptest.ads new file mode 100644 index 0000000000..13a7c92552 --- /dev/null +++ b/c/src/ada-tests/mptests/mp02/mptest.ads @@ -0,0 +1,165 @@ +-- +-- MPTEST / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package is the specification for Test 2 of the RTEMS +-- Multiprocessor Test Suite. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest.ads,v 1.3 1995/07/12 19:38:42 joel Exp +-- + +with CLOCK_DRIVER; +with BSP_MPCI; +with RTEMS; + +package MPTEST is + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS tasks created +-- by this test. +-- + + TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.ID; + TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.NAME; + +-- +-- INIT +-- +-- DESCRIPTION: +-- +-- This RTEMS task initializes the application. +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ); + +-- +-- TEST_TASK +-- +-- DESCRIPTION: +-- +-- This is the body of the RTEMS tasks which constitute this test. +-- + + procedure TEST_TASK ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ); + +-- +-- This is the Driver Address Table for this test. +-- + + DEVICE_DRIVERS : aliased RTEMS.DRIVER_ADDRESS_TABLE( 1 .. 1 ) := + (1=> + ( + CLOCK_DRIVER.INITIALIZE'ACCESS, -- Initialization + RTEMS.NO_DRIVER_ENTRY, -- Open + RTEMS.NO_DRIVER_ENTRY, -- Close + RTEMS.NO_DRIVER_ENTRY, -- Read + RTEMS.NO_DRIVER_ENTRY, -- Write + RTEMS.NO_DRIVER_ENTRY -- Control + ) + ); + +-- +-- This is the Initialization Tasks Table for this test. +-- + + INITIALIZATION_TASKS : aliased RTEMS.INITIALIZATION_TASKS_TABLE( 1 .. 1 ) := + (1=> + ( + RTEMS.BUILD_NAME( 'U', 'I', '1', ' ' ), -- task name + 2048, -- stack size + 1, -- priority + RTEMS.DEFAULT_ATTRIBUTES, -- attributes + MPTEST.INIT'ACCESS, -- entry point + RTEMS.NO_PREEMPT, -- initial mode + 0 -- argument list + ) + ); + +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- +-- BEGIN SUBPACKAGE -- +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- + + -- + -- MPTEST.PER_NODE_CONFIGURATION / SPECIFICATION + -- + -- DESCRIPTION: + -- + -- This package is the specification for the subpackage + -- which will define the per node configuration parameters. + -- + + package PER_NODE_CONFIGURATION is + + -- + -- LOCAL_NODE_NUMBER + -- + -- DESCRIPTION: + -- + -- This function returns the node number for this node. + -- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32; + + pragma INLINE ( LOCAL_NODE_NUMBER ); + + end PER_NODE_CONFIGURATION; + +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- +-- END SUBPACKAGE -- +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- + +-- +-- This is the Multiprocessor Configuration Table for this test. +-- + + MULTIPROCESSING_CONFIGURATION : aliased RTEMS.MULTIPROCESSING_TABLE := ( + MPTEST.PER_NODE_CONFIGURATION.LOCAL_NODE_NUMBER, + 2, -- maximum # nodes in system + 32, -- maximum # global objects + 32 -- maximum # proxies + ); + +-- +-- This is the Configuration Table for this test. +-- + + CONFIGURATION : aliased RTEMS.CONFIGURATION_TABLE := ( + RTEMS.NULL_ADDRESS, -- will be replaced by BSP + 64 * 1024, -- executive RAM size + 10, -- maximum # tasks + 0, -- maximum # timers + 0, -- maximum # semaphores + 0, -- maximum # message queues + 0, -- maximum # messages + 0, -- maximum # partitions + 0, -- maximum # regions + 0, -- maximum # dp memory areas + 0, -- maximum # periods + 0, -- maximum # user extensions + RTEMS.MILLISECONDS_TO_MICROSECONDS(10), -- # us in a tick + 50 -- # ticks in a timeslice + ); + +end MPTEST; diff --git a/c/src/ada-tests/mptests/mp02/node1/mptest-per_node_configuration.adb b/c/src/ada-tests/mptests/mp02/node1/mptest-per_node_configuration.adb new file mode 100644 index 0000000000..c3abb62da5 --- /dev/null +++ b/c/src/ada-tests/mptests/mp02/node1/mptest-per_node_configuration.adb @@ -0,0 +1,43 @@ +-- +-- MPTEST.PER_NODE_CONFIGURATION / BODY +-- +-- DESCRIPTION: +-- +-- This package is the specification for the subpackage +-- which will define the per node configuration parameters. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest-per_node_configuration.adb,v 1.2 1995/05/31 16:32:48 joel Exp +-- + +with RTEMS; + +separate ( MPTEST ) + +package body PER_NODE_CONFIGURATION is + +--PAGE +-- +-- LOCAL_NODE_NUMBER +-- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32 is + begin + + return 1; + + end LOCAL_NODE_NUMBER; + +end PER_NODE_CONFIGURATION; diff --git a/c/src/ada-tests/mptests/mp02/node2/mptest-per_node_configuration.adb b/c/src/ada-tests/mptests/mp02/node2/mptest-per_node_configuration.adb new file mode 100644 index 0000000000..1efdccce9a --- /dev/null +++ b/c/src/ada-tests/mptests/mp02/node2/mptest-per_node_configuration.adb @@ -0,0 +1,43 @@ +-- +-- MPTEST.PER_NODE_CONFIGURATION / BODY +-- +-- DESCRIPTION: +-- +-- This package is the specification for the subpackage +-- which will define the per node configuration parameters. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest-per_node_configuration.adb,v 1.2 1995/05/31 16:33:01 joel Exp +-- + +with RTEMS; + +separate ( MPTEST ) + +package body PER_NODE_CONFIGURATION is + +--PAGE +-- +-- LOCAL_NODE_NUMBER +-- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32 is + begin + + return 2; + + end LOCAL_NODE_NUMBER; + +end PER_NODE_CONFIGURATION; diff --git a/c/src/ada-tests/mptests/mp03/mptest.adb b/c/src/ada-tests/mptests/mp03/mptest.adb new file mode 100644 index 0000000000..d86f3afa74 --- /dev/null +++ b/c/src/ada-tests/mptests/mp03/mptest.adb @@ -0,0 +1,277 @@ +-- +-- MPTEST / BODY +-- +-- DESCRIPTION: +-- +-- This package is the implementation for Test 3 of the RTEMS +-- Multiprocessor Test Suite. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest.adb,v 1.3 1995/07/12 19:38:49 joel Exp +-- + +with INTERFACES; use INTERFACES; +with RTEMS; +with TEST_SUPPORT; +with TEXT_IO; +with UNSIGNED32_IO; + +package body MPTEST is + + package body PER_NODE_CONFIGURATION is separate; + +--PAGE +-- +-- INIT +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ) is + STATUS : RTEMS.STATUS_CODES; + begin + + TEXT_IO.NEW_LINE( 2 ); + TEXT_IO.PUT( "*** TEST 3 -- NODE " ); + UNSIGNED32_IO.PUT( + MPTEST.MULTIPROCESSING_CONFIGURATION.NODE, + WIDTH => 1 + ); + TEXT_IO.PUT_LINE( " ***" ); + + MPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( '1', '1', '1', ' ' ); + MPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( '2', '2', '2', ' ' ); + + TEXT_IO.PUT_LINE( "Creating Test_task (Global)" ); + RTEMS.TASK_CREATE( + MPTEST.TASK_NAME( MPTEST.MULTIPROCESSING_CONFIGURATION.NODE ), + 1, + 2048, + RTEMS.NO_PREEMPT, + RTEMS.GLOBAL, + MPTEST.TASK_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" ); + + TEXT_IO.PUT_LINE( "Starting Test_task (Global)" ); + RTEMS.TASK_START( + MPTEST.TASK_ID( 1 ), + MPTEST.TEST_TASK'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" ); + + MPTEST.TIMER_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'M', '1', ' ' ); + + RTEMS.TIMER_CREATE( + MPTEST.TIMER_NAME( 1 ), + MPTEST.TIMER_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_CREATE" ); + + TEXT_IO.PUT_LINE( "Deleting initialization task" ); + RTEMS.TASK_DELETE( RTEMS.SELF, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" ); + + end INIT; + +--PAGE +-- +-- DELAYED_SEND_EVENT +-- + + procedure DELAYED_SEND_EVENT ( + IGNORED_ID : in RTEMS.ID; + IGNORED_ADDRESS : in RTEMS.ADDRESS + ) is + STATUS : RTEMS.STATUS_CODES; + begin + + RTEMS.EVENT_SEND( MPTEST.TASK_ID( 1 ), RTEMS.EVENT_16, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_SEND" ); + + end DELAYED_SEND_EVENT; + +--PAGE +-- +-- TEST_TASK +-- + + procedure TEST_TASK ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ) is + TID : RTEMS.ID; + STATUS : RTEMS.STATUS_CODES; + begin + + RTEMS.TASK_IDENT( RTEMS.SELF, RTEMS.SEARCH_ALL_NODES, TID, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_IDENT OF SELF" ); + + TEXT_IO.PUT_LINE( "Getting TID of remote task" ); + if MPTEST.MULTIPROCESSING_CONFIGURATION.NODE = 1 then + MPTEST.REMOTE_NODE := 2; + else + MPTEST.REMOTE_NODE := 1; + end if; + + TEXT_IO.PUT( "Remote task's name is : " ); + TEST_SUPPORT.PUT_NAME( MPTEST.TASK_NAME( MPTEST.REMOTE_NODE ), TRUE ); + + loop + + RTEMS.TASK_IDENT( + MPTEST.TASK_NAME( MPTEST.REMOTE_NODE ), + RTEMS.SEARCH_ALL_NODES, + MPTEST.REMOTE_TID, + STATUS + ); + + exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS ); + + end loop; + + RTEMS.TIMER_FIRE_AFTER( + MPTEST.TIMER_ID( 1 ), + 10 * TEST_SUPPORT.TICKS_PER_SECOND, + MPTEST.DELAYED_SEND_EVENT'ACCESS, + RTEMS.NULL_ADDRESS, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_AFTER" ); + + MPTEST.TEST_TASK_SUPPORT( 1 ); + + RTEMS.TIMER_FIRE_AFTER( + MPTEST.TIMER_ID( 1 ), + 11 * TEST_SUPPORT.TICKS_PER_SECOND, + MPTEST.DELAYED_SEND_EVENT'ACCESS, + RTEMS.NULL_ADDRESS, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_AFTER" ); + + if MPTEST.MULTIPROCESSING_CONFIGURATION.NODE = 2 then + + RTEMS.TASK_WAKE_AFTER( + 2 * TEST_SUPPORT.TICKS_PER_SECOND, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + end if; + + MPTEST.TEST_TASK_SUPPORT( 2 ); + + TEXT_IO.PUT_LINE( "*** END OF TEST 3 ***" ); + + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end TEST_TASK; + +--PAGE +-- +-- TEST_TASK_SUPPORT +-- + + + procedure TEST_TASK_SUPPORT ( + NODE : in RTEMS.UNSIGNED32 + ) is + EVENTS : RTEMS.EVENT_SET; + STATUS : RTEMS.STATUS_CODES; + begin + + if MPTEST.MULTIPROCESSING_CONFIGURATION.NODE = NODE then + + loop + + RTEMS.EVENT_RECEIVE( + RTEMS.EVENT_16, + RTEMS.NO_WAIT, + RTEMS.NO_TIMEOUT, + EVENTS, + STATUS + ); + + exit when RTEMS.ARE_STATUSES_EQUAL( RTEMS.SUCCESSFUL, STATUS ); + + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.UNSATISFIED, + "EVENT_RECEIVE" + ); + + RTEMS.TASK_WAKE_AFTER( + 2 * TEST_SUPPORT.TICKS_PER_SECOND, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + TEST_SUPPORT.PUT_NAME( MPTEST.TASK_NAME( NODE ), FALSE ); + TEXT_IO.PUT_LINE( " - Suspending remote task" ); + RTEMS.TASK_SUSPEND( MPTEST.REMOTE_TID, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SUSPEND" ); + + RTEMS.TASK_WAKE_AFTER( + 2 * TEST_SUPPORT.TICKS_PER_SECOND, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + TEST_SUPPORT.PUT_NAME( MPTEST.TASK_NAME( NODE ), FALSE ); + TEXT_IO.PUT_LINE( " - Resuming remote task" ); + + RTEMS.TASK_RESUME( MPTEST.REMOTE_TID, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_RESUME" ); + + end loop; + + else + + loop + + RTEMS.EVENT_RECEIVE( + RTEMS.EVENT_16, + RTEMS.NO_WAIT, + RTEMS.NO_TIMEOUT, + EVENTS, + STATUS + ); + + exit when RTEMS.ARE_STATUSES_EQUAL( RTEMS.SUCCESSFUL, STATUS ); + + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.UNSATISFIED, + "EVENT_RECEIVE" + ); + + TEST_SUPPORT.PUT_NAME( MPTEST.TASK_NAME( REMOTE_NODE ), FALSE ); + TEXT_IO.PUT_LINE( " - have I been suspended???" ); + RTEMS.TASK_WAKE_AFTER( + TEST_SUPPORT.TICKS_PER_SECOND / 2, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + end loop; + + end if; + + end TEST_TASK_SUPPORT; + +end MPTEST; diff --git a/c/src/ada-tests/mptests/mp03/mptest.ads b/c/src/ada-tests/mptests/mp03/mptest.ads new file mode 100644 index 0000000000..c8bece6af5 --- /dev/null +++ b/c/src/ada-tests/mptests/mp03/mptest.ads @@ -0,0 +1,215 @@ +-- +-- MPTEST / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package is the specification for Test 3 of the RTEMS +-- Multiprocessor Test Suite. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest.ads,v 1.3 1995/07/12 19:38:50 joel Exp +-- + +with CLOCK_DRIVER; +with BSP_MPCI; +with RTEMS; + +package MPTEST is + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS tasks created +-- by this test. +-- + + TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.ID; + TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.NAME; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS timers created +-- by this test. +-- + + TIMER_ID : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.ID; + TIMER_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.NAME; + +-- +-- This variable contains the ID of the remote task with which this +-- test interacts. +-- + + REMOTE_TID : RTEMS.ID; + +-- +-- This variable contains the node on which the remote task with which +-- this test interacts resides. +-- + + REMOTE_NODE : RTEMS.UNSIGNED32; + +-- +-- INIT +-- +-- DESCRIPTION: +-- +-- This RTEMS task initializes the application. +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ); + +-- +-- DELAYED_SEND_EVENT +-- +-- DESCRIPTION: +-- +-- This subprogram is a timer service routine which sends an +-- event set to a waiting task. +-- + + procedure DELAYED_SEND_EVENT ( + IGNORED_ID : in RTEMS.ID; + IGNORED_ADDRESS : in RTEMS.ADDRESS + ); + +-- +-- TEST_TASK +-- +-- DESCRIPTION: +-- +-- This is the body of the RTEMS tasks which constitute this test. +-- + + procedure TEST_TASK ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ); + +-- +-- TEST_TASK_SUPPORT +-- +-- DESCRIPTION: +-- +-- This subprogram performs the bulk of the test. Based on the NODE +-- specified, this subprogram loops suspending/resuming a remote task +-- or waiting for itself to be suspended/resumed. +-- + + procedure TEST_TASK_SUPPORT ( + NODE : in RTEMS.UNSIGNED32 + ); + +-- +-- This is the Driver Address Table for this test. +-- + + DEVICE_DRIVERS : aliased RTEMS.DRIVER_ADDRESS_TABLE( 1 .. 1 ) := + (1=> + ( + CLOCK_DRIVER.INITIALIZE'ACCESS, -- Initialization + RTEMS.NO_DRIVER_ENTRY, -- Open + RTEMS.NO_DRIVER_ENTRY, -- Close + RTEMS.NO_DRIVER_ENTRY, -- Read + RTEMS.NO_DRIVER_ENTRY, -- Write + RTEMS.NO_DRIVER_ENTRY -- Control + ) + ); + +-- +-- This is the Initialization Tasks Table for this test. +-- + + INITIALIZATION_TASKS : aliased RTEMS.INITIALIZATION_TASKS_TABLE( 1 .. 1 ) := + (1=> + ( + RTEMS.BUILD_NAME( 'U', 'I', '1', ' ' ), -- task name + 2048, -- stack size + 1, -- priority + RTEMS.DEFAULT_ATTRIBUTES, -- attributes + MPTEST.INIT'ACCESS, -- entry point + RTEMS.NO_PREEMPT, -- initial mode + 0 -- argument list + ) + ); + +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- +-- BEGIN SUBPACKAGE -- +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- + + -- + -- MPTEST.PER_NODE_CONFIGURATION / SPECIFICATION + -- + -- DESCRIPTION: + -- + -- This package is the specification for the subpackage + -- which will define the per node configuration parameters. + -- + + package PER_NODE_CONFIGURATION is + + -- + -- LOCAL_NODE_NUMBER + -- + -- DESCRIPTION: + -- + -- This function returns the node number for this node. + -- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32; + + pragma INLINE ( LOCAL_NODE_NUMBER ); + + end PER_NODE_CONFIGURATION; + +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- +-- END SUBPACKAGE -- +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- + +-- +-- This is the Multiprocessor Configuration Table for this test. +-- + + MULTIPROCESSING_CONFIGURATION : aliased RTEMS.MULTIPROCESSING_TABLE := ( + MPTEST.PER_NODE_CONFIGURATION.LOCAL_NODE_NUMBER, + 2, -- maximum # nodes in system + 32, -- maximum # global objects + 32 -- maximum # proxies + ); + +-- +-- This is the Configuration Table for this test. +-- + + CONFIGURATION : aliased RTEMS.CONFIGURATION_TABLE := ( + RTEMS.NULL_ADDRESS, -- will be replaced by BSP + 64 * 1024, -- executive RAM size + 10, -- maximum # tasks + 1, -- maximum # timers + 0, -- maximum # semaphores + 0, -- maximum # message queues + 0, -- maximum # messages + 0, -- maximum # partitions + 0, -- maximum # regions + 0, -- maximum # dp memory areas + 0, -- maximum # periods + 0, -- maximum # user extensions + RTEMS.MILLISECONDS_TO_MICROSECONDS(10), -- # us in a tick + 50 -- # ticks in a timeslice + ); + +end MPTEST; diff --git a/c/src/ada-tests/mptests/mp03/node1/mptest-per_node_configuration.adb b/c/src/ada-tests/mptests/mp03/node1/mptest-per_node_configuration.adb new file mode 100644 index 0000000000..f82dc5212f --- /dev/null +++ b/c/src/ada-tests/mptests/mp03/node1/mptest-per_node_configuration.adb @@ -0,0 +1,43 @@ +-- +-- MPTEST.PER_NODE_CONFIGURATION / BODY +-- +-- DESCRIPTION: +-- +-- This package is the specification for the subpackage +-- which will define the per node configuration parameters. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest-per_node_configuration.adb,v 1.2 1995/05/31 16:33:05 joel Exp +-- + +with RTEMS; + +separate ( MPTEST ) + +package body PER_NODE_CONFIGURATION is + +--PAGE +-- +-- LOCAL_NODE_NUMBER +-- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32 is + begin + + return 1; + + end LOCAL_NODE_NUMBER; + +end PER_NODE_CONFIGURATION; diff --git a/c/src/ada-tests/mptests/mp03/node2/mptest-per_node_configuration.adb b/c/src/ada-tests/mptests/mp03/node2/mptest-per_node_configuration.adb new file mode 100644 index 0000000000..27631265e6 --- /dev/null +++ b/c/src/ada-tests/mptests/mp03/node2/mptest-per_node_configuration.adb @@ -0,0 +1,43 @@ +-- +-- MPTEST.PER_NODE_CONFIGURATION / BODY +-- +-- DESCRIPTION: +-- +-- This package is the specification for the subpackage +-- which will define the per node configuration parameters. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest-per_node_configuration.adb,v 1.2 1995/05/31 16:33:16 joel Exp +-- + +with RTEMS; + +separate ( MPTEST ) + +package body PER_NODE_CONFIGURATION is + +--PAGE +-- +-- LOCAL_NODE_NUMBER +-- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32 is + begin + + return 2; + + end LOCAL_NODE_NUMBER; + +end PER_NODE_CONFIGURATION; diff --git a/c/src/ada-tests/mptests/mp04/mptest.adb b/c/src/ada-tests/mptests/mp04/mptest.adb new file mode 100644 index 0000000000..95f51ec9b2 --- /dev/null +++ b/c/src/ada-tests/mptests/mp04/mptest.adb @@ -0,0 +1,169 @@ +-- +-- MPTEST / BODY +-- +-- DESCRIPTION: +-- +-- This package is the implementation for Test 4 of the RTEMS +-- Multiprocessor Test Suite. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest.adb,v 1.3 1995/07/12 19:38:59 joel Exp +-- + +with INTERFACES; use INTERFACES; +with RTEMS; +with TEST_SUPPORT; +with TEXT_IO; +with UNSIGNED32_IO; + +package body MPTEST is + + package body PER_NODE_CONFIGURATION is separate; + +--PAGE +-- +-- INIT +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ) is + STATUS : RTEMS.STATUS_CODES; + begin + + TEXT_IO.NEW_LINE( 2 ); + TEXT_IO.PUT( "*** TEST 4 -- NODE " ); + UNSIGNED32_IO.PUT( + MPTEST.MULTIPROCESSING_CONFIGURATION.NODE, + WIDTH => 1 + ); + TEXT_IO.PUT_LINE( " ***" ); + + MPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( '1', '1', '1', ' ' ); + MPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( '2', '2', '2', ' ' ); + + TEXT_IO.PUT_LINE( "Creating Test_task (Global)" ); + + RTEMS.TASK_CREATE( + MPTEST.TASK_NAME( MPTEST.MULTIPROCESSING_CONFIGURATION.NODE ), + MPTEST.MULTIPROCESSING_CONFIGURATION.NODE, + 2048, + RTEMS.DEFAULT_MODES, + RTEMS.GLOBAL, + MPTEST.TASK_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" ); + + TEXT_IO.PUT_LINE( "Starting Test_task (Global)" ); + + RTEMS.TASK_START( + MPTEST.TASK_ID( 1 ), + MPTEST.TEST_TASK'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" ); + + TEXT_IO.PUT_LINE( "Deleting initialization task" ); + + RTEMS.TASK_DELETE( RTEMS.SELF, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" ); + + end INIT; + +--PAGE +-- +-- TEST_TASK +-- + + procedure TEST_TASK ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ) is + TID : RTEMS.ID; + PREVIOUS_PRIORITY : RTEMS.TASK_PRIORITY; + PREVIOUS_PRIORITY_1 : RTEMS.TASK_PRIORITY; + STATUS : RTEMS.STATUS_CODES; + begin + + RTEMS.TASK_IDENT( RTEMS.SELF, RTEMS.SEARCH_ALL_NODES, TID, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_IDENT OF SELF" ); + + TEXT_IO.PUT_LINE( "Getting TID of remote task" ); + if MPTEST.MULTIPROCESSING_CONFIGURATION.NODE = 1 then + MPTEST.REMOTE_NODE := 2; + else + MPTEST.REMOTE_NODE := 1; + end if; + + TEXT_IO.PUT( "Remote task's name is : " ); + TEST_SUPPORT.PUT_NAME( MPTEST.TASK_NAME( MPTEST.REMOTE_NODE ), TRUE ); + + loop + + RTEMS.TASK_IDENT( + MPTEST.TASK_NAME( MPTEST.REMOTE_NODE ), + RTEMS.SEARCH_ALL_NODES, + MPTEST.REMOTE_TID, + STATUS + ); + + exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS ); + + end loop; + + RTEMS.TASK_SET_PRIORITY( + MPTEST.REMOTE_TID, + MPTEST.MULTIPROCESSING_CONFIGURATION.NODE, + PREVIOUS_PRIORITY, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SET_PRIORITY" ); + + if PREVIOUS_PRIORITY /= MPTEST.REMOTE_NODE then + + TEXT_IO.PUT( "Remote priority (0x" ); + UNSIGNED32_IO.PUT( PREVIOUS_PRIORITY, BASE => 16 ); + TEXT_IO.PUT( "does not match remote node (0x" ); + UNSIGNED32_IO.PUT( MPTEST.REMOTE_NODE, BASE => 16 ); + TEXT_IO.PUT_LINE( ")!!!" ); + + RTEMS.SHUTDOWN_EXECUTIVE( 16#F00000# ); + + end if; + + loop + + RTEMS.TASK_SET_PRIORITY( + RTEMS.SELF, + RTEMS.CURRENT_PRIORITY, + PREVIOUS_PRIORITY_1, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SET_PRIORITY" ); + + exit when PREVIOUS_PRIORITY_1 = MPTEST.REMOTE_NODE; + + end loop; + + + TEXT_IO.PUT_LINE( "Local task priority has been set" ); + + TEXT_IO.PUT_LINE( "*** END OF TEST 4 ***" ); + + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end TEST_TASK; + +end MPTEST; diff --git a/c/src/ada-tests/mptests/mp04/mptest.ads b/c/src/ada-tests/mptests/mp04/mptest.ads new file mode 100644 index 0000000000..7afbac328a --- /dev/null +++ b/c/src/ada-tests/mptests/mp04/mptest.ads @@ -0,0 +1,179 @@ +-- +-- MPTEST / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package is the specification for Test 4 of the RTEMS +-- Multiprocessor Test Suite. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest.ads,v 1.3 1995/07/12 19:38:59 joel Exp +-- + +with CLOCK_DRIVER; +with BSP_MPCI; +with RTEMS; + +package MPTEST is + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS tasks created +-- by this test. +-- + + TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.ID; + TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.NAME; + +-- +-- This variable contains the ID of the remote task with which this +-- test interacts. +-- + + REMOTE_TID : RTEMS.ID; + +-- +-- This variable contains the node on which the remote task with which +-- this test interacts resides. +-- + + REMOTE_NODE : RTEMS.UNSIGNED32; + +-- +-- INIT +-- +-- DESCRIPTION: +-- +-- This RTEMS task initializes the application. +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ); + +-- +-- TEST_TASK +-- +-- DESCRIPTION: +-- +-- This is the body of the RTEMS tasks which constitute this test. +-- + + procedure TEST_TASK ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ); + +-- +-- This is the Driver Address Table for this test. +-- + + DEVICE_DRIVERS : aliased RTEMS.DRIVER_ADDRESS_TABLE( 1 .. 1 ) := + (1=> + ( + CLOCK_DRIVER.INITIALIZE'ACCESS, -- Initialization + RTEMS.NO_DRIVER_ENTRY, -- Open + RTEMS.NO_DRIVER_ENTRY, -- Close + RTEMS.NO_DRIVER_ENTRY, -- Read + RTEMS.NO_DRIVER_ENTRY, -- Write + RTEMS.NO_DRIVER_ENTRY -- Control + ) + ); + +-- +-- This is the Initialization Tasks Table for this test. +-- + + INITIALIZATION_TASKS : aliased RTEMS.INITIALIZATION_TASKS_TABLE( 1 .. 1 ) := + (1=> + ( + RTEMS.BUILD_NAME( 'U', 'I', '1', ' ' ), -- task name + 2048, -- stack size + 1, -- priority + RTEMS.DEFAULT_ATTRIBUTES, -- attributes + MPTEST.INIT'ACCESS, -- entry point + RTEMS.NO_PREEMPT, -- initial mode + 0 -- argument list + ) + ); + +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- +-- BEGIN SUBPACKAGE -- +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- + + -- + -- MPTEST.PER_NODE_CONFIGURATION / SPECIFICATION + -- + -- DESCRIPTION: + -- + -- This package is the specification for the subpackage + -- which will define the per node configuration parameters. + -- + + package PER_NODE_CONFIGURATION is + + -- + -- LOCAL_NODE_NUMBER + -- + -- DESCRIPTION: + -- + -- This function returns the node number for this node. + -- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32; + + pragma INLINE ( LOCAL_NODE_NUMBER ); + + end PER_NODE_CONFIGURATION; + +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- +-- END SUBPACKAGE -- +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- + +-- +-- This is the Multiprocessor Configuration Table for this test. +-- + + MULTIPROCESSING_CONFIGURATION : aliased RTEMS.MULTIPROCESSING_TABLE := ( + MPTEST.PER_NODE_CONFIGURATION.LOCAL_NODE_NUMBER, + 2, -- maximum # nodes in system + 32, -- maximum # global objects + 32 -- maximum # proxies + ); + +-- +-- This is the Configuration Table for this test. +-- + + CONFIGURATION : aliased RTEMS.CONFIGURATION_TABLE := ( + RTEMS.NULL_ADDRESS, -- will be replaced by BSP + 64 * 1024, -- executive RAM size + 10, -- maximum # tasks + 1, -- maximum # timers + 0, -- maximum # semaphores + 0, -- maximum # message queues + 0, -- maximum # messages + 0, -- maximum # partitions + 0, -- maximum # regions + 0, -- maximum # dp memory areas + 0, -- maximum # periods + 0, -- maximum # user extensions + RTEMS.MILLISECONDS_TO_MICROSECONDS(10), -- # us in a tick + 50 -- # ticks in a timeslice + ); + +end MPTEST; diff --git a/c/src/ada-tests/mptests/mp04/node1/mptest-per_node_configuration.adb b/c/src/ada-tests/mptests/mp04/node1/mptest-per_node_configuration.adb new file mode 100644 index 0000000000..8c3c5193ba --- /dev/null +++ b/c/src/ada-tests/mptests/mp04/node1/mptest-per_node_configuration.adb @@ -0,0 +1,43 @@ +-- +-- MPTEST.PER_NODE_CONFIGURATION / BODY +-- +-- DESCRIPTION: +-- +-- This package is the specification for the subpackage +-- which will define the per node configuration parameters. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest-per_node_configuration.adb,v 1.2 1995/05/31 16:33:20 joel Exp +-- + +with RTEMS; + +separate ( MPTEST ) + +package body PER_NODE_CONFIGURATION is + +--PAGE +-- +-- LOCAL_NODE_NUMBER +-- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32 is + begin + + return 1; + + end LOCAL_NODE_NUMBER; + +end PER_NODE_CONFIGURATION; diff --git a/c/src/ada-tests/mptests/mp04/node2/mptest-per_node_configuration.adb b/c/src/ada-tests/mptests/mp04/node2/mptest-per_node_configuration.adb new file mode 100644 index 0000000000..2d8c65f4b3 --- /dev/null +++ b/c/src/ada-tests/mptests/mp04/node2/mptest-per_node_configuration.adb @@ -0,0 +1,43 @@ +-- +-- MPTEST.PER_NODE_CONFIGURATION / BODY +-- +-- DESCRIPTION: +-- +-- This package is the specification for the subpackage +-- which will define the per node configuration parameters. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest-per_node_configuration.adb,v 1.2 1995/05/31 16:33:31 joel Exp +-- + +with RTEMS; + +separate ( MPTEST ) + +package body PER_NODE_CONFIGURATION is + +--PAGE +-- +-- LOCAL_NODE_NUMBER +-- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32 is + begin + + return 2; + + end LOCAL_NODE_NUMBER; + +end PER_NODE_CONFIGURATION; diff --git a/c/src/ada-tests/mptests/mp05/mptest.adb b/c/src/ada-tests/mptests/mp05/mptest.adb new file mode 100644 index 0000000000..3ca7689ce9 --- /dev/null +++ b/c/src/ada-tests/mptests/mp05/mptest.adb @@ -0,0 +1,252 @@ +-- +-- MPTEST / BODY +-- +-- DESCRIPTION: +-- +-- This package is the implementation for Test 5 of the RTEMS +-- Multiprocessor Test Suite. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest.adb,v 1.3 1995/07/12 19:39:06 joel Exp +-- + +with INTERFACES; use INTERFACES; +with RTEMS; +with TEST_SUPPORT; +with TEXT_IO; +with UNSIGNED32_IO; + +package body MPTEST is + + package body PER_NODE_CONFIGURATION is separate; + +--PAGE +-- +-- INIT +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ) is + STATUS : RTEMS.STATUS_CODES; + begin + + TEXT_IO.NEW_LINE( 2 ); + TEXT_IO.PUT( "*** TEST 5 -- NODE " ); + UNSIGNED32_IO.PUT( + MPTEST.MULTIPROCESSING_CONFIGURATION.NODE, + WIDTH => 1 + ); + TEXT_IO.PUT_LINE( " ***" ); + + MPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( '1', '1', '1', ' ' ); + MPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( '2', '2', '2', ' ' ); + + TEXT_IO.PUT_LINE( "Creating Test_task (Global)" ); + + RTEMS.TASK_CREATE( + MPTEST.TASK_NAME( MPTEST.MULTIPROCESSING_CONFIGURATION.NODE ), + 1, + 2048, + RTEMS.TIMESLICE, + RTEMS.GLOBAL, + MPTEST.TASK_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" ); + + TEXT_IO.PUT_LINE( "Starting Test_task (Global)" ); + + RTEMS.TASK_START( + MPTEST.TASK_ID( 1 ), + MPTEST.TEST_TASK'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" ); + + MPTEST.TIMER_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'M', '1', ' ' ); + MPTEST.TIMER_NAME( 2 ) := RTEMS.BUILD_NAME( 'T', 'M', '2', ' ' ); + + RTEMS.TIMER_CREATE( + MPTEST.TIMER_NAME( MPTEST.MULTIPROCESSING_CONFIGURATION.NODE ), + MPTEST.TIMER_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_CREATE" ); + + TEXT_IO.PUT_LINE( "Deleting initialization task" ); + + RTEMS.TASK_DELETE( RTEMS.SELF, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" ); + + end INIT; + +--PAGE +-- +-- PROCESS_ASR +-- + + procedure PROCESS_ASR ( + SIGNAL : in RTEMS.SIGNAL_SET + ) + is + begin + + if SIGNAL /= MPTEST.EXPECTED_SIGNAL then + + TEXT_IO.PUT( "ERROR: I was expecting signal 0x" ); + UNSIGNED32_IO.PUT( EXPECTED_SIGNAL, BASE => 16 ); + TEXT_IO.PUT( " got 0x" ); + UNSIGNED32_IO.PUT( SIGNAL, BASE => 16 ); + TEXT_IO.NEW_LINE; + + RTEMS.FATAL_ERROR_OCCURRED( 16#000F_0000# ); + + end if; + + MPTEST.SIGNAL_CAUGHT := TRUE; + + end PROCESS_ASR; + +--PAGE +-- +-- STOP_TEST_TSR +-- + + procedure STOP_TEST_TSR ( + IGNORED_ID : in RTEMS.ID; + IGNORED_ADDRESS : in RTEMS.ADDRESS + ) is + begin + + MPTEST.STOP_TEST := TRUE; + + end STOP_TEST_TSR; + +--PAGE +-- +-- TEST_TASK +-- + + procedure TEST_TASK ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ) is + STATUS : RTEMS.STATUS_CODES; + begin + + MPTEST.STOP_TEST := FALSE; + + MPTEST.SIGNAL_CAUGHT := FALSE; + MPTEST.SIGNAL_COUNT := 0; + + TEXT_IO.PUT_LINE( "signal_catch: initializing signal catcher" ); + RTEMS.SIGNAL_CATCH( + MPTEST.PROCESS_ASR'ACCESS, + RTEMS.NO_ASR + RTEMS.NO_PREEMPT, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SIGNAL_CATCH" ); + + if MPTEST.MULTIPROCESSING_CONFIGURATION.NODE = 1 then + MPTEST.REMOTE_NODE := 2; + MPTEST.REMOTE_SIGNAL := RTEMS.SIGNAL_18; + MPTEST.EXPECTED_SIGNAL := RTEMS.SIGNAL_17; + else + MPTEST.REMOTE_NODE := 1; + MPTEST.REMOTE_SIGNAL := RTEMS.SIGNAL_17; + MPTEST.EXPECTED_SIGNAL := RTEMS.SIGNAL_18; + end if; + + TEXT_IO.PUT( "Remote task's name is : " ); + TEST_SUPPORT.PUT_NAME( MPTEST.TASK_NAME( MPTEST.REMOTE_NODE ), TRUE ); + + TEXT_IO.PUT_LINE( "Getting TID of remote task" ); + loop + + RTEMS.TASK_IDENT( + MPTEST.TASK_NAME( MPTEST.REMOTE_NODE ), + RTEMS.SEARCH_ALL_NODES, + MPTEST.REMOTE_TID, + STATUS + ); + + exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS ); + + end loop; + + RTEMS.TIMER_FIRE_AFTER( + MPTEST.TIMER_ID( 1 ), + 3 * TEST_SUPPORT.TICKS_PER_SECOND, + MPTEST.STOP_TEST_TSR'ACCESS, + RTEMS.NULL_ADDRESS, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_AFTER" ); + + if MPTEST.MULTIPROCESSING_CONFIGURATION.NODE = 1 then + + TEXT_IO.PUT_LINE( "Sending signal to remote task" ); + loop + RTEMS.SIGNAL_SEND( + MPTEST.REMOTE_TID, + MPTEST.REMOTE_SIGNAL, + STATUS + ); + + exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS ); + + exit when not RTEMS.ARE_STATUSES_EQUAL( STATUS, RTEMS.NOT_DEFINED ); + + end loop; + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SIGNAL_SEND" ); + + end if; + + loop + + exit when MPTEST.STOP_TEST = TRUE; + + if MPTEST.SIGNAL_CAUGHT = TRUE then + + MPTEST.SIGNAL_CAUGHT := FALSE; + MPTEST.SIGNAL_COUNT := MPTEST.SIGNAL_COUNT + 1; + + if MPTEST.SIGNAL_COUNT >= MPTEST.SIGNALS_PER_DOT then + + MPTEST.SIGNAL_COUNT := 0; + + TEST_SUPPORT.PUT_DOT( "." ); + + end if; + + RTEMS.SIGNAL_SEND( + MPTEST.REMOTE_TID, + MPTEST.REMOTE_SIGNAL, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SIGNAL_SEND" ); + + end if; + + end loop; + + TEXT_IO.NEW_LINE; + TEXT_IO.PUT_LINE( "*** END OF TEST 5 ***" ); + + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end TEST_TASK; + +end MPTEST; diff --git a/c/src/ada-tests/mptests/mp05/mptest.ads b/c/src/ada-tests/mptests/mp05/mptest.ads new file mode 100644 index 0000000000..9706506d08 --- /dev/null +++ b/c/src/ada-tests/mptests/mp05/mptest.ads @@ -0,0 +1,244 @@ +-- +-- MPTEST / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package is the specification for Test 5 of the RTEMS +-- Multiprocessor Test Suite. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest.ads,v 1.3 1995/07/12 19:39:07 joel Exp +-- + +with CLOCK_DRIVER; +with BSP_MPCI; +with RTEMS; + +package MPTEST is + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS tasks created +-- by this test. +-- + + TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.ID; + TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.NAME; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS timers created +-- by this test. +-- + + TIMER_ID : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.ID; + TIMER_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.NAME; + +-- +-- This variable is set when the test should stop executing. +-- + STOP_TEST : RTEMS.BOOLEAN; + +-- +-- This variable contains the ID of the remote task with which this +-- test interacts. +-- + + REMOTE_TID : RTEMS.ID; + +-- +-- This variable contains the node on which the remote task with which +-- this test interacts resides. +-- + + REMOTE_NODE : RTEMS.UNSIGNED32; + +-- +-- This is the signal set which is sent to the task on the other node. +-- + + REMOTE_SIGNAL : RTEMS.SIGNAL_SET; + +-- +-- This is the signal set the task on this node expects to receive +-- from the other node. +-- + + EXPECTED_SIGNAL : RTEMS.SIGNAL_SET; + +-- +-- These keep track of if a signal set has been caught and how many +-- signal sets have been caught cumulative. +-- + + SIGNAL_CAUGHT : RTEMS.BOOLEAN; + SIGNAL_COUNT : RTEMS.UNSIGNED32; + +-- +-- The number of signals to process per dot printed out. +-- + + SIGNALS_PER_DOT : constant RTEMS.UNSIGNED32 := 15; + +-- +-- INIT +-- +-- DESCRIPTION: +-- +-- This RTEMS task initializes the application. +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ); + +-- +-- PROCESS_ASR +-- +-- DESCRIPTION: +-- +-- This subprogram is an ASR for TEST_TASK. +-- + + procedure PROCESS_ASR ( + SIGNAL : in RTEMS.SIGNAL_SET + ); + +-- +-- STOP_TEST_TSR +-- +-- DESCRIPTION: +-- +-- This subprogram is a TSR which sets the "stop test" flag. +-- + + procedure STOP_TEST_TSR ( + IGNORED_ID : in RTEMS.ID; + IGNORED_ADDRESS : in RTEMS.ADDRESS + ); + +-- +-- TEST_TASK +-- +-- DESCRIPTION: +-- +-- This is the body of the RTEMS tasks which constitute this test. +-- + + procedure TEST_TASK ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ); + +-- +-- This is the Driver Address Table for this test. +-- + + DEVICE_DRIVERS : aliased RTEMS.DRIVER_ADDRESS_TABLE( 1 .. 1 ) := + (1=> + ( + CLOCK_DRIVER.INITIALIZE'ACCESS, -- Initialization + RTEMS.NO_DRIVER_ENTRY, -- Open + RTEMS.NO_DRIVER_ENTRY, -- Close + RTEMS.NO_DRIVER_ENTRY, -- Read + RTEMS.NO_DRIVER_ENTRY, -- Write + RTEMS.NO_DRIVER_ENTRY -- Control + ) + ); + +-- +-- This is the Initialization Tasks Table for this test. +-- + + INITIALIZATION_TASKS : aliased RTEMS.INITIALIZATION_TASKS_TABLE( 1 .. 1 ) := + (1=> + ( + RTEMS.BUILD_NAME( 'U', 'I', '1', ' ' ), -- task name + 2048, -- stack size + 1, -- priority + RTEMS.DEFAULT_ATTRIBUTES, -- attributes + MPTEST.INIT'ACCESS, -- entry point + RTEMS.NO_PREEMPT, -- initial mode + 0 -- argument list + ) + ); + +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- +-- BEGIN SUBPACKAGE -- +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- + + -- + -- MPTEST.PER_NODE_CONFIGURATION / SPECIFICATION + -- + -- DESCRIPTION: + -- + -- This package is the specification for the subpackage + -- which will define the per node configuration parameters. + -- + + package PER_NODE_CONFIGURATION is + + -- + -- LOCAL_NODE_NUMBER + -- + -- DESCRIPTION: + -- + -- This function returns the node number for this node. + -- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32; + + pragma INLINE ( LOCAL_NODE_NUMBER ); + + end PER_NODE_CONFIGURATION; + +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- +-- END SUBPACKAGE -- +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- + +-- +-- This is the Multiprocessor Configuration Table for this test. +-- + + MULTIPROCESSING_CONFIGURATION : aliased RTEMS.MULTIPROCESSING_TABLE := ( + MPTEST.PER_NODE_CONFIGURATION.LOCAL_NODE_NUMBER, + 2, -- maximum # nodes in system + 32, -- maximum # global objects + 32 -- maximum # proxies + ); + +-- +-- This is the Configuration Table for this test. +-- + + CONFIGURATION : aliased RTEMS.CONFIGURATION_TABLE := ( + RTEMS.NULL_ADDRESS, -- will be replaced by BSP + 64 * 1024, -- executive RAM size + 10, -- maximum # tasks + 1, -- maximum # timers + 2, -- maximum # semaphores + 0, -- maximum # message queues + 0, -- maximum # messages + 0, -- maximum # partitions + 0, -- maximum # regions + 0, -- maximum # dp memory areas + 0, -- maximum # periods + 0, -- maximum # user extensions + RTEMS.MILLISECONDS_TO_MICROSECONDS(10), -- # us in a tick + 50 -- # ticks in a timeslice + ); + +end MPTEST; diff --git a/c/src/ada-tests/mptests/mp05/node1/mptest-per_node_configuration.adb b/c/src/ada-tests/mptests/mp05/node1/mptest-per_node_configuration.adb new file mode 100644 index 0000000000..eb87437c43 --- /dev/null +++ b/c/src/ada-tests/mptests/mp05/node1/mptest-per_node_configuration.adb @@ -0,0 +1,43 @@ +-- +-- MPTEST.PER_NODE_CONFIGURATION / BODY +-- +-- DESCRIPTION: +-- +-- This package is the specification for the subpackage +-- which will define the per node configuration parameters. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest-per_node_configuration.adb,v 1.2 1995/05/31 16:33:35 joel Exp +-- + +with RTEMS; + +separate ( MPTEST ) + +package body PER_NODE_CONFIGURATION is + +--PAGE +-- +-- LOCAL_NODE_NUMBER +-- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32 is + begin + + return 1; + + end LOCAL_NODE_NUMBER; + +end PER_NODE_CONFIGURATION; diff --git a/c/src/ada-tests/mptests/mp05/node2/mptest-per_node_configuration.adb b/c/src/ada-tests/mptests/mp05/node2/mptest-per_node_configuration.adb new file mode 100644 index 0000000000..c36a6eddea --- /dev/null +++ b/c/src/ada-tests/mptests/mp05/node2/mptest-per_node_configuration.adb @@ -0,0 +1,43 @@ +-- +-- MPTEST.PER_NODE_CONFIGURATION / BODY +-- +-- DESCRIPTION: +-- +-- This package is the specification for the subpackage +-- which will define the per node configuration parameters. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest-per_node_configuration.adb,v 1.2 1995/05/31 16:33:45 joel Exp +-- + +with RTEMS; + +separate ( MPTEST ) + +package body PER_NODE_CONFIGURATION is + +--PAGE +-- +-- LOCAL_NODE_NUMBER +-- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32 is + begin + + return 2; + + end LOCAL_NODE_NUMBER; + +end PER_NODE_CONFIGURATION; diff --git a/c/src/ada-tests/mptests/mp06/mptest.adb b/c/src/ada-tests/mptests/mp06/mptest.adb new file mode 100644 index 0000000000..b837015d29 --- /dev/null +++ b/c/src/ada-tests/mptests/mp06/mptest.adb @@ -0,0 +1,257 @@ +-- +-- MPTEST / BODY +-- +-- DESCRIPTION: +-- +-- This package is the implementation for Test 6 of the RTEMS +-- Multiprocessor Test Suite. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest.adb,v 1.3 1995/07/12 19:39:14 joel Exp +-- + +with INTERFACES; use INTERFACES; +with RTEMS; +with TEST_SUPPORT; +with TEXT_IO; +with UNSIGNED32_IO; + +package body MPTEST is + + package body PER_NODE_CONFIGURATION is separate; + +--PAGE +-- +-- INIT +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ) is + STATUS : RTEMS.STATUS_CODES; + begin + + TEXT_IO.NEW_LINE( 2 ); + TEXT_IO.PUT( "*** TEST 6 -- NODE " ); + UNSIGNED32_IO.PUT( + MPTEST.MULTIPROCESSING_CONFIGURATION.NODE, + WIDTH => 1 + ); + TEXT_IO.PUT_LINE( " ***" ); + + MPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( '1', '1', '1', ' ' ); + MPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( '2', '2', '2', ' ' ); + + TEXT_IO.PUT_LINE( "Creating Test_task (Global)" ); + + RTEMS.TASK_CREATE( + MPTEST.TASK_NAME( MPTEST.MULTIPROCESSING_CONFIGURATION.NODE ), + MPTEST.MULTIPROCESSING_CONFIGURATION.NODE, + 2048, + RTEMS.DEFAULT_MODES, + RTEMS.GLOBAL, + MPTEST.TASK_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" ); + + TEXT_IO.PUT_LINE( "Starting Test_task (Global)" ); + + RTEMS.TASK_START( + MPTEST.TASK_ID( 1 ), + MPTEST.TEST_TASK'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" ); + + MPTEST.TIMER_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'M', '1', ' ' ); + MPTEST.TIMER_NAME( 2 ) := RTEMS.BUILD_NAME( 'T', 'M', '2', ' ' ); + + RTEMS.TIMER_CREATE( + MPTEST.TIMER_NAME( MPTEST.MULTIPROCESSING_CONFIGURATION.NODE ), + MPTEST.TIMER_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_CREATE" ); + + TEXT_IO.PUT_LINE( "Deleting initialization task" ); + + RTEMS.TASK_DELETE( RTEMS.SELF, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" ); + + end INIT; + +--PAGE +-- +-- STOP_TEST_TSR +-- + + procedure STOP_TEST_TSR ( + IGNORED1 : in RTEMS.ID; + IGNORED2 : in RTEMS.ADDRESS + ) is + begin + + MPTEST.STOP_TEST := TRUE; + + end STOP_TEST_TSR; + +--PAGE +-- +-- TEST_TASK +-- + + procedure TEST_TASK ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ) is + COUNT : RTEMS.UNSIGNED32; + EVENT_OUT : RTEMS.EVENT_SET; + EVENT_FOR_THIS_ITERATION : RTEMS.EVENT_SET; + STATUS : RTEMS.STATUS_CODES; + begin + + MPTEST.STOP_TEST := FALSE; + + if MPTEST.MULTIPROCESSING_CONFIGURATION.NODE = 1 then + MPTEST.REMOTE_NODE := 2; + else + MPTEST.REMOTE_NODE := 1; + end if; + + TEXT_IO.PUT( "Remote task's name is : " ); + TEST_SUPPORT.PUT_NAME( MPTEST.TASK_NAME( MPTEST.REMOTE_NODE ), TRUE ); + + TEXT_IO.PUT_LINE( "Getting TID of remote task" ); + + loop + + RTEMS.TASK_IDENT( + MPTEST.TASK_NAME( MPTEST.REMOTE_NODE ), + RTEMS.SEARCH_ALL_NODES, + MPTEST.REMOTE_TID, + STATUS + ); + + exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS ); + + end loop; + + if MPTEST.MULTIPROCESSING_CONFIGURATION.NODE = 1 then + TEXT_IO.PUT_LINE( "Sending events to remote task" ); + else + TEXT_IO.PUT_LINE( "Receiving events from remote task" ); + end if; + + RTEMS.TIMER_FIRE_AFTER( + MPTEST.TIMER_ID( 1 ), + 5 * TEST_SUPPORT.TICKS_PER_SECOND, + MPTEST.STOP_TEST_TSR'ACCESS, + RTEMS.NULL_ADDRESS, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_AFTER" ); + + COUNT := 0; + + loop + + exit when MPTEST.STOP_TEST = TRUE; + + EVENT_FOR_THIS_ITERATION := + MPTEST.EVENT_SET_TABLE( + INTEGER( COUNT ) mod MPTEST.EVENT_SET_TABLE'LAST + 1 + ); + + if MPTEST.MULTIPROCESSING_CONFIGURATION.NODE = 1 then + + RTEMS.EVENT_SEND( + MPTEST.REMOTE_TID, + EVENT_FOR_THIS_ITERATION, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_SEND" ); + + else + + RTEMS.EVENT_RECEIVE( + EVENT_FOR_THIS_ITERATION, + RTEMS.DEFAULT_OPTIONS, + 1 * TEST_SUPPORT.TICKS_PER_SECOND, + EVENT_OUT, + STATUS + ); + + if RTEMS.ARE_STATUSES_EQUAL( STATUS, RTEMS.TIMEOUT ) then + TEXT_IO.NEW_LINE( 1 ); + + if MPTEST.MULTIPROCESSING_CONFIGURATION.NODE = 2 then + TEXT_IO.PUT_LINE( + "Correct behavior if the other node exitted." + ); + else + TEXT_IO.PUT_LINE( + "ERROR... node 1 died" + ); + end if; + + exit; + + else + + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_RECEIVE" ); + + end if; + + end if; + + if (COUNT mod MPTEST.MAXIMUM_DOTS) = 0 then + + TEST_SUPPORT.PUT_DOT( "." ); + + end if; + + COUNT := COUNT + 1; + + end loop; + + TEXT_IO.NEW_LINE; + + if MPTEST.MULTIPROCESSING_CONFIGURATION.NODE = 2 then + + RTEMS.EVENT_RECEIVE( + RTEMS.EVENT_16, + RTEMS.DEFAULT_OPTIONS, + 1 * TEST_SUPPORT.TICKS_PER_SECOND, + EVENT_OUT, + STATUS + ); + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + RTEMS.TIMEOUT, + STATUS, + "EVENT_RECEIVE" + ); + + TEXT_IO.NEW_LINE; + TEXT_IO.PUT_LINE( "event_receive - correctly returned TIMEOUT" ); + + end if; + + TEXT_IO.PUT_LINE( "*** END OF TEST 6 ***" ); + + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end TEST_TASK; + +end MPTEST; diff --git a/c/src/ada-tests/mptests/mp06/mptest.ads b/c/src/ada-tests/mptests/mp06/mptest.ads new file mode 100644 index 0000000000..3bb33b1590 --- /dev/null +++ b/c/src/ada-tests/mptests/mp06/mptest.ads @@ -0,0 +1,251 @@ +-- +-- MPTEST / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package is the specification for Test 6 of the RTEMS +-- Multiprocessor Test Suite. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest.ads,v 1.3 1995/07/12 19:39:15 joel Exp +-- + +with CLOCK_DRIVER; +with BSP_MPCI; +with RTEMS; + +package MPTEST is + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS tasks created +-- by this test. +-- + + TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.ID; + TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.NAME; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS timers created +-- by this test. +-- + + TIMER_ID : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.ID; + TIMER_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.NAME; + +-- +-- This variable is set when the test should stop executing. +-- + STOP_TEST : RTEMS.BOOLEAN; + +-- +-- This variable contains the ID of the remote task with which this +-- test interacts. +-- + + REMOTE_TID : RTEMS.ID; + +-- +-- This variable contains the node on which the remote task with which +-- this test interacts resides. +-- + + REMOTE_NODE : RTEMS.UNSIGNED32; + +-- +-- The number of signals to process per dot printed out. +-- + + MAXIMUM_DOTS : constant RTEMS.UNSIGNED32 := 25; + +-- +-- The following is a table of the event sets which consist of +-- a single event. This test cycles through all of these +-- events. +-- + + EVENT_SET_TABLE : constant array ( 0 .. 30 ) of RTEMS.EVENT_SET := ( + RTEMS.EVENT_0, + RTEMS.EVENT_1, + RTEMS.EVENT_2, + RTEMS.EVENT_3, + RTEMS.EVENT_4, + RTEMS.EVENT_5, + RTEMS.EVENT_6, + RTEMS.EVENT_7, + RTEMS.EVENT_8, + RTEMS.EVENT_9, + RTEMS.EVENT_10, + RTEMS.EVENT_11, + RTEMS.EVENT_12, + RTEMS.EVENT_13, + RTEMS.EVENT_14, + RTEMS.EVENT_15, + RTEMS.EVENT_16, + RTEMS.EVENT_17, + RTEMS.EVENT_18, + RTEMS.EVENT_19, + RTEMS.EVENT_20, + RTEMS.EVENT_21, + RTEMS.EVENT_22, + RTEMS.EVENT_23, + RTEMS.EVENT_24, + RTEMS.EVENT_25, + RTEMS.EVENT_26, + RTEMS.EVENT_27, + RTEMS.EVENT_28, + RTEMS.EVENT_29, + RTEMS.EVENT_30 + ); + +-- +-- INIT +-- +-- DESCRIPTION: +-- +-- This RTEMS task initializes the application. +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ); + +-- +-- STOP_TEST_TSR +-- +-- DESCRIPTION: +-- +-- This subprogram is a TSR which sets the "stop test" flag. +-- + + procedure STOP_TEST_TSR ( + IGNORED1 : in RTEMS.ID; + IGNORED2 : in RTEMS.ADDRESS + ); + +-- +-- TEST_TASK +-- +-- DESCRIPTION: +-- +-- This is the body of the RTEMS tasks which constitute this test. +-- + + procedure TEST_TASK ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ); + +-- +-- This is the Driver Address Table for this test. +-- + + DEVICE_DRIVERS : aliased RTEMS.DRIVER_ADDRESS_TABLE( 1 .. 1 ) := + (1=> + ( + CLOCK_DRIVER.INITIALIZE'ACCESS, -- Initialization + RTEMS.NO_DRIVER_ENTRY, -- Open + RTEMS.NO_DRIVER_ENTRY, -- Close + RTEMS.NO_DRIVER_ENTRY, -- Read + RTEMS.NO_DRIVER_ENTRY, -- Write + RTEMS.NO_DRIVER_ENTRY -- Control + ) + ); + +-- +-- This is the Initialization Tasks Table for this test. +-- + + INITIALIZATION_TASKS : aliased RTEMS.INITIALIZATION_TASKS_TABLE( 1 .. 1 ) := + (1=> + ( + RTEMS.BUILD_NAME( 'U', 'I', '1', ' ' ), -- task name + 2048, -- stack size + 1, -- priority + RTEMS.DEFAULT_ATTRIBUTES, -- attributes + MPTEST.INIT'ACCESS, -- entry point + RTEMS.NO_PREEMPT, -- initial mode + 0 -- argument list + ) + ); + +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- +-- BEGIN SUBPACKAGE -- +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- + + -- + -- MPTEST.PER_NODE_CONFIGURATION / SPECIFICATION + -- + -- DESCRIPTION: + -- + -- This package is the specification for the subpackage + -- which will define the per node configuration parameters. + -- + + package PER_NODE_CONFIGURATION is + + -- + -- LOCAL_NODE_NUMBER + -- + -- DESCRIPTION: + -- + -- This function returns the node number for this node. + -- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32; + + pragma INLINE ( LOCAL_NODE_NUMBER ); + + end PER_NODE_CONFIGURATION; + +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- +-- END SUBPACKAGE -- +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- + +-- +-- This is the Multiprocessor Configuration Table for this test. +-- + + MULTIPROCESSING_CONFIGURATION : aliased RTEMS.MULTIPROCESSING_TABLE := ( + MPTEST.PER_NODE_CONFIGURATION.LOCAL_NODE_NUMBER, + 2, -- maximum # nodes in system + 32, -- maximum # global objects + 32 -- maximum # proxies + ); + +-- +-- This is the Configuration Table for this test. +-- + + CONFIGURATION : aliased RTEMS.CONFIGURATION_TABLE := ( + RTEMS.NULL_ADDRESS, -- will be replaced by BSP + 64 * 1024, -- executive RAM size + 10, -- maximum # tasks + 1, -- maximum # timers + 2, -- maximum # semaphores + 0, -- maximum # message queues + 0, -- maximum # messages + 0, -- maximum # partitions + 0, -- maximum # regions + 0, -- maximum # dp memory areas + 0, -- maximum # periods + 0, -- maximum # user extensions + RTEMS.MILLISECONDS_TO_MICROSECONDS(10), -- # us in a tick + 50 -- # ticks in a timeslice + ); + +end MPTEST; diff --git a/c/src/ada-tests/mptests/mp06/node1/mptest-per_node_configuration.adb b/c/src/ada-tests/mptests/mp06/node1/mptest-per_node_configuration.adb new file mode 100644 index 0000000000..d99d94e252 --- /dev/null +++ b/c/src/ada-tests/mptests/mp06/node1/mptest-per_node_configuration.adb @@ -0,0 +1,43 @@ +-- +-- MPTEST.PER_NODE_CONFIGURATION / BODY +-- +-- DESCRIPTION: +-- +-- This package is the specification for the subpackage +-- which will define the per node configuration parameters. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest-per_node_configuration.adb,v 1.2 1995/05/31 16:33:49 joel Exp +-- + +with RTEMS; + +separate ( MPTEST ) + +package body PER_NODE_CONFIGURATION is + +--PAGE +-- +-- LOCAL_NODE_NUMBER +-- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32 is + begin + + return 1; + + end LOCAL_NODE_NUMBER; + +end PER_NODE_CONFIGURATION; diff --git a/c/src/ada-tests/mptests/mp06/node2/mptest-per_node_configuration.adb b/c/src/ada-tests/mptests/mp06/node2/mptest-per_node_configuration.adb new file mode 100644 index 0000000000..7990910c07 --- /dev/null +++ b/c/src/ada-tests/mptests/mp06/node2/mptest-per_node_configuration.adb @@ -0,0 +1,43 @@ +-- +-- MPTEST.PER_NODE_CONFIGURATION / BODY +-- +-- DESCRIPTION: +-- +-- This package is the specification for the subpackage +-- which will define the per node configuration parameters. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest-per_node_configuration.adb,v 1.2 1995/05/31 16:34:00 joel Exp +-- + +with RTEMS; + +separate ( MPTEST ) + +package body PER_NODE_CONFIGURATION is + +--PAGE +-- +-- LOCAL_NODE_NUMBER +-- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32 is + begin + + return 2; + + end LOCAL_NODE_NUMBER; + +end PER_NODE_CONFIGURATION; diff --git a/c/src/ada-tests/mptests/mp07/mptest.adb b/c/src/ada-tests/mptests/mp07/mptest.adb new file mode 100644 index 0000000000..40cea9bf27 --- /dev/null +++ b/c/src/ada-tests/mptests/mp07/mptest.adb @@ -0,0 +1,210 @@ +-- +-- MPTEST / BODY +-- +-- DESCRIPTION: +-- +-- This package is the implementation for Test 7 of the RTEMS +-- Multiprocessor Test Suite. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest.adb,v 1.3 1995/07/12 19:39:22 joel Exp +-- + +with INTERFACES; use INTERFACES; +with RTEMS; +with TEST_SUPPORT; +with TEXT_IO; +with UNSIGNED32_IO; + +package body MPTEST is + + package body PER_NODE_CONFIGURATION is separate; + +--PAGE +-- +-- INIT +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ) is + STATUS : RTEMS.STATUS_CODES; + begin + + TEXT_IO.NEW_LINE( 2 ); + TEXT_IO.PUT( "*** TEST 7 -- NODE " ); + UNSIGNED32_IO.PUT( + MPTEST.MULTIPROCESSING_CONFIGURATION.NODE, + WIDTH => 1 + ); + TEXT_IO.PUT_LINE( " ***" ); + + MPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( '1', '1', '1', ' ' ); + MPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( '2', '2', '2', ' ' ); + + TEXT_IO.PUT_LINE( "Creating Test_task (Global)" ); + RTEMS.TASK_CREATE( + MPTEST.TASK_NAME( MPTEST.MULTIPROCESSING_CONFIGURATION.NODE ), + MPTEST.MULTIPROCESSING_CONFIGURATION.NODE, + 2048, + RTEMS.TIMESLICE, + RTEMS.GLOBAL, + MPTEST.TASK_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" ); + + TEXT_IO.PUT_LINE( "Starting Test_task (Global)" ); + RTEMS.TASK_START( + MPTEST.TASK_ID( 1 ), + MPTEST.TEST_TASK'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" ); + + MPTEST.TIMER_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'M', '1', ' ' ); + + RTEMS.TIMER_CREATE( + MPTEST.TIMER_NAME( 1 ), + MPTEST.TIMER_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_CREATE" ); + + TEXT_IO.PUT_LINE( "Deleting initialization task" ); + RTEMS.TASK_DELETE( RTEMS.SELF, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" ); + + end INIT; + +--PAGE +-- +-- STOP_TEST_TSR +-- + + procedure STOP_TEST_TSR ( + IGNORED1 : in RTEMS.ID; + IGNORED2 : in RTEMS.ADDRESS + ) is + begin + + MPTEST.STOP_TEST := TRUE; + + end STOP_TEST_TSR; + +--PAGE +-- +-- TEST_TASK +-- + + procedure TEST_TASK ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ) is + COUNT : RTEMS.UNSIGNED32; + EVENT_OUT : RTEMS.EVENT_SET; + STATUS : RTEMS.STATUS_CODES; + begin + + MPTEST.STOP_TEST := FALSE; + + if MPTEST.MULTIPROCESSING_CONFIGURATION.NODE = 1 then + MPTEST.REMOTE_NODE := 2; + else + MPTEST.REMOTE_NODE := 1; + end if; + + TEXT_IO.PUT( "Remote task's name is : " ); + TEST_SUPPORT.PUT_NAME( MPTEST.TASK_NAME( MPTEST.REMOTE_NODE ), TRUE ); + + TEXT_IO.PUT_LINE( "Getting TID of remote task" ); + loop + RTEMS.TASK_IDENT( + MPTEST.TASK_NAME( MPTEST.REMOTE_NODE ), + RTEMS.SEARCH_ALL_NODES, + MPTEST.REMOTE_TID, + STATUS + ); + + exit when RTEMS.ARE_STATUSES_EQUAL( STATUS, RTEMS.SUCCESSFUL ); + + end loop; + + if MPTEST.MULTIPROCESSING_CONFIGURATION.NODE = 1 then + + TEXT_IO.PUT_LINE( "Sending first event to remote task" ); + RTEMS.EVENT_SEND( + MPTEST.REMOTE_TID, + RTEMS.EVENT_16, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_SEND" ); + + end if; + + RTEMS.TIMER_FIRE_AFTER( + MPTEST.TIMER_ID( 1 ), + 5 * TEST_SUPPORT.TICKS_PER_SECOND, + MPTEST.STOP_TEST_TSR'ACCESS, + RTEMS.NULL_ADDRESS, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_AFTER" ); + + loop + + exit when MPTEST.STOP_TEST = TRUE; + + for COUNT in 1 .. MPTEST.PER_DOT + loop + + RTEMS.EVENT_RECEIVE( + RTEMS.EVENT_16, + RTEMS.DEFAULT_OPTIONS, + TEST_SUPPORT.TICKS_PER_SECOND, + EVENT_OUT, + STATUS + ); + if RTEMS.ARE_STATUSES_EQUAL( STATUS, RTEMS.TIMEOUT ) then + TEXT_IO.NEW_LINE; + TEXT_IO.PUT_LINE( + "TA1 - TIMEOUT .. probably OK if the other node exits" + ); + exit; + else + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_RECEIVE" ); + end if; + + RTEMS.EVENT_SEND( + MPTEST.REMOTE_TID, + RTEMS.EVENT_16, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_SEND" ); + + end loop; + + TEST_SUPPORT.PUT_DOT( "." ); + + end loop; + + TEXT_IO.NEW_LINE; + + TEXT_IO.PUT_LINE( "*** END OF TEST 7 ***" ); + + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end TEST_TASK; + +end MPTEST; diff --git a/c/src/ada-tests/mptests/mp07/mptest.ads b/c/src/ada-tests/mptests/mp07/mptest.ads new file mode 100644 index 0000000000..2a793db21d --- /dev/null +++ b/c/src/ada-tests/mptests/mp07/mptest.ads @@ -0,0 +1,211 @@ +-- +-- MPTEST / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package is the specification for Test 7 of the RTEMS +-- Multiprocessor Test Suite. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest.ads,v 1.3 1995/07/12 19:39:23 joel Exp +-- + +with CLOCK_DRIVER; +with BSP_MPCI; +with RTEMS; + +package MPTEST is + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS tasks created +-- by this test. +-- + + TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.ID; + TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.NAME; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS timers created +-- by this test. +-- + + TIMER_ID : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.ID; + TIMER_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.NAME; + +-- +-- This variable is set when the test should stop executing. +-- + STOP_TEST : RTEMS.BOOLEAN; + +-- +-- This variable contains the ID of the remote task with which this +-- test interacts. +-- + + REMOTE_TID : RTEMS.ID; + +-- +-- This variable contains the node on which the remote task with which +-- this test interacts resides. +-- + + REMOTE_NODE : RTEMS.UNSIGNED32; + +-- +-- The number of events to process per dot printed out. +-- + + PER_DOT : constant RTEMS.UNSIGNED32 := 100; + +-- +-- INIT +-- +-- DESCRIPTION: +-- +-- This RTEMS task initializes the application. +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ); + +-- +-- STOP_TEST_TSR +-- +-- DESCRIPTION: +-- +-- This subprogram is a TSR which sets the "stop test" flag. +-- + + procedure STOP_TEST_TSR ( + IGNORED1 : in RTEMS.ID; + IGNORED2 : in RTEMS.ADDRESS + ); + +-- +-- TEST_TASK +-- +-- DESCRIPTION: +-- +-- This is the body of the RTEMS tasks which constitute this test. +-- + + procedure TEST_TASK ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ); + +-- +-- This is the Driver Address Table for this test. +-- + + DEVICE_DRIVERS : aliased RTEMS.DRIVER_ADDRESS_TABLE( 1 .. 1 ) := + (1=> + ( + CLOCK_DRIVER.INITIALIZE'ACCESS, -- Initialization + RTEMS.NO_DRIVER_ENTRY, -- Open + RTEMS.NO_DRIVER_ENTRY, -- Close + RTEMS.NO_DRIVER_ENTRY, -- Read + RTEMS.NO_DRIVER_ENTRY, -- Write + RTEMS.NO_DRIVER_ENTRY -- Control + ) + ); + +-- +-- This is the Initialization Tasks Table for this test. +-- + + INITIALIZATION_TASKS : aliased RTEMS.INITIALIZATION_TASKS_TABLE( 1 .. 1 ) := + (1=> + ( + RTEMS.BUILD_NAME( 'U', 'I', '1', ' ' ), -- task name + 2048, -- stack size + 1, -- priority + RTEMS.DEFAULT_ATTRIBUTES, -- attributes + MPTEST.INIT'ACCESS, -- entry point + RTEMS.NO_PREEMPT, -- initial mode + 0 -- argument list + ) + ); + +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- +-- BEGIN SUBPACKAGE -- +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- + + -- + -- MPTEST.PER_NODE_CONFIGURATION / SPECIFICATION + -- + -- DESCRIPTION: + -- + -- This package is the specification for the subpackage + -- which will define the per node configuration parameters. + -- + + package PER_NODE_CONFIGURATION is + + -- + -- LOCAL_NODE_NUMBER + -- + -- DESCRIPTION: + -- + -- This function returns the node number for this node. + -- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32; + + pragma INLINE ( LOCAL_NODE_NUMBER ); + + end PER_NODE_CONFIGURATION; + +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- +-- END SUBPACKAGE -- +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- + +-- +-- This is the Multiprocessor Configuration Table for this test. +-- + + MULTIPROCESSING_CONFIGURATION : aliased RTEMS.MULTIPROCESSING_TABLE := ( + MPTEST.PER_NODE_CONFIGURATION.LOCAL_NODE_NUMBER, + 2, -- maximum # nodes in system + 32, -- maximum # global objects + 32 -- maximum # proxies + ); + +-- +-- This is the Configuration Table for this test. +-- + + CONFIGURATION : aliased RTEMS.CONFIGURATION_TABLE := ( + RTEMS.NULL_ADDRESS, -- will be replaced by BSP + 64 * 1024, -- executive RAM size + 10, -- maximum # tasks + 1, -- maximum # timers + 2, -- maximum # semaphores + 0, -- maximum # message queues + 0, -- maximum # messages + 0, -- maximum # partitions + 0, -- maximum # regions + 0, -- maximum # dp memory areas + 0, -- maximum # periods + 0, -- maximum # user extensions + RTEMS.MILLISECONDS_TO_MICROSECONDS(10), -- # us in a tick + 50 -- # ticks in a timeslice + ); + +end MPTEST; diff --git a/c/src/ada-tests/mptests/mp07/node1/mptest-per_node_configuration.adb b/c/src/ada-tests/mptests/mp07/node1/mptest-per_node_configuration.adb new file mode 100644 index 0000000000..786d1d8d68 --- /dev/null +++ b/c/src/ada-tests/mptests/mp07/node1/mptest-per_node_configuration.adb @@ -0,0 +1,43 @@ +-- +-- MPTEST.PER_NODE_CONFIGURATION / BODY +-- +-- DESCRIPTION: +-- +-- This package is the specification for the subpackage +-- which will define the per node configuration parameters. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest-per_node_configuration.adb,v 1.2 1995/05/31 16:34:05 joel Exp +-- + +with RTEMS; + +separate ( MPTEST ) + +package body PER_NODE_CONFIGURATION is + +--PAGE +-- +-- LOCAL_NODE_NUMBER +-- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32 is + begin + + return 1; + + end LOCAL_NODE_NUMBER; + +end PER_NODE_CONFIGURATION; diff --git a/c/src/ada-tests/mptests/mp07/node2/mptest-per_node_configuration.adb b/c/src/ada-tests/mptests/mp07/node2/mptest-per_node_configuration.adb new file mode 100644 index 0000000000..9d463f0002 --- /dev/null +++ b/c/src/ada-tests/mptests/mp07/node2/mptest-per_node_configuration.adb @@ -0,0 +1,43 @@ +-- +-- MPTEST.PER_NODE_CONFIGURATION / BODY +-- +-- DESCRIPTION: +-- +-- This package is the specification for the subpackage +-- which will define the per node configuration parameters. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest-per_node_configuration.adb,v 1.2 1995/05/31 16:34:15 joel Exp +-- + +with RTEMS; + +separate ( MPTEST ) + +package body PER_NODE_CONFIGURATION is + +--PAGE +-- +-- LOCAL_NODE_NUMBER +-- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32 is + begin + + return 2; + + end LOCAL_NODE_NUMBER; + +end PER_NODE_CONFIGURATION; diff --git a/c/src/ada-tests/mptests/mp08/mptest.adb b/c/src/ada-tests/mptests/mp08/mptest.adb new file mode 100644 index 0000000000..306c5f0caf --- /dev/null +++ b/c/src/ada-tests/mptests/mp08/mptest.adb @@ -0,0 +1,207 @@ +-- +-- MPTEST / BODY +-- +-- DESCRIPTION: +-- +-- This package is the implementation for Test 8 of the RTEMS +-- Multiprocessor Test Suite. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest.adb,v 1.3 1995/07/12 19:39:34 joel Exp +-- + +with INTERFACES; use INTERFACES; +with RTEMS; +with TEST_SUPPORT; +with TEXT_IO; +with UNSIGNED32_IO; + +package body MPTEST is + + package body PER_NODE_CONFIGURATION is separate; + +--PAGE +-- +-- INIT +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ) is + STATUS : RTEMS.STATUS_CODES; + begin + + TEXT_IO.NEW_LINE( 2 ); + TEXT_IO.PUT( "*** TEST 8 -- NODE " ); + UNSIGNED32_IO.PUT( + MPTEST.MULTIPROCESSING_CONFIGURATION.NODE, + WIDTH => 1 + ); + TEXT_IO.PUT_LINE( " ***" ); + + MPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( '1', '1', '1', ' ' ); + MPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( '2', '2', '2', ' ' ); + + MPTEST.SEMAPHORE_NAME( 1 ) := RTEMS.BUILD_NAME( 'S', 'E', 'M', ' ' ); + + if MPTEST.MULTIPROCESSING_CONFIGURATION.NODE = 1 then + + TEXT_IO.PUT_LINE( "Creating Semaphore(Global)" ); + + RTEMS.SEMAPHORE_CREATE( + MPTEST.SEMAPHORE_NAME( 1 ), + 1, + RTEMS.GLOBAL, + MPTEST.SEMAPHORE_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_CREATE" ); + + end if; + + TEXT_IO.PUT_LINE( "Creating Test_task (Global)" ); + RTEMS.TASK_CREATE( + MPTEST.TASK_NAME( MPTEST.MULTIPROCESSING_CONFIGURATION.NODE ), + MPTEST.MULTIPROCESSING_CONFIGURATION.NODE, + 2048, + RTEMS.TIMESLICE, + RTEMS.GLOBAL, + MPTEST.TASK_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" ); + + TEXT_IO.PUT_LINE( "Starting Test_task (Global)" ); + RTEMS.TASK_START( + MPTEST.TASK_ID( 1 ), + MPTEST.TEST_TASK'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" ); + + TEXT_IO.PUT_LINE( "Deleting initialization task" ); + RTEMS.TASK_DELETE( RTEMS.SELF, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" ); + + end INIT; + +--PAGE +-- +-- TEST_TASK +-- + + procedure TEST_TASK ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ) is + DOTS : RTEMS.UNSIGNED32; + COUNT : RTEMS.UNSIGNED32; + STATUS : RTEMS.STATUS_CODES; + begin + + TEXT_IO.PUT_LINE( "Getting SMID of semaphore" ); + loop + + RTEMS.SEMAPHORE_IDENT( + MPTEST.SEMAPHORE_NAME( 1 ), + RTEMS.SEARCH_ALL_NODES, + MPTEST.SEMAPHORE_ID( 1 ), + STATUS + ); + + exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS ); + + end loop; + + if MPTEST.MULTIPROCESSING_CONFIGURATION.NODE = 2 then + + RTEMS.SEMAPHORE_DELETE( + MPTEST.SEMAPHORE_ID( 1 ), + STATUS + ); + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.ILLEGAL_ON_REMOTE_OBJECT, + "SEMAPHORE_DELETE" + ); + + TEXT_IO.PUT_LINE( + "semaphore_delete correctly returned ILLEGAL_ON_REMOTE_OBJECT" + ); + + end if; + + COUNT := 0; + + loop + + TEST_SUPPORT.PUT_DOT( "p" ); + + RTEMS.SEMAPHORE_OBTAIN( + MPTEST.SEMAPHORE_ID( 1 ), + RTEMS.DEFAULT_OPTIONS, + RTEMS.NO_TIMEOUT, + STATUS + ); + + if not RTEMS.IS_STATUS_SUCCESSFUL( STATUS ) then + + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.OBJECT_WAS_DELETED, + "SEMAPHORE_OBTAIN" + ); + + TEXT_IO.NEW_LINE; + + TEXT_IO.PUT_LINE( "Global semaphore deleted" ); + + TEXT_IO.PUT_LINE( "*** END OF TEST 8 ***" ); + + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end if; + + COUNT := COUNT + 1; + + if MPTEST.MULTIPROCESSING_CONFIGURATION.NODE = 1 and then + COUNT >= 1000 then + + RTEMS.TASK_WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + TEXT_IO.NEW_LINE; + + TEXT_IO.PUT_LINE( "Deleting global semaphore" ); + + RTEMS.SEMAPHORE_DELETE( MPTEST.SEMAPHORE_ID( 1 ), STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_DELETE" ); + + TEXT_IO.PUT_LINE( "*** END OF TEST 8 ***" ); + + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end if; + + TEST_SUPPORT.PUT_DOT( "v" ); + + RTEMS.SEMAPHORE_RELEASE( MPTEST.SEMAPHORE_ID( 1 ), STATUS ); + + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_RELEASE" ); + + end loop; + + end TEST_TASK; + +end MPTEST; diff --git a/c/src/ada-tests/mptests/mp08/mptest.ads b/c/src/ada-tests/mptests/mp08/mptest.ads new file mode 100644 index 0000000000..81650d5799 --- /dev/null +++ b/c/src/ada-tests/mptests/mp08/mptest.ads @@ -0,0 +1,193 @@ +-- +-- MPTEST / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package is the specification for Test 8 of the RTEMS +-- Multiprocessor Test Suite. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest.ads,v 1.3 1995/07/12 19:39:38 joel Exp +-- + +with CLOCK_DRIVER; +with BSP_MPCI; +with RTEMS; + +package MPTEST is + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS tasks created +-- by this test. +-- + + TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.ID; + TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.NAME; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS semaphores created +-- by this test. +-- + + SEMAPHORE_ID : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.ID; + SEMAPHORE_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.NAME; + +-- +-- This variable contains the ID of the remote task with which this +-- test interacts. +-- + + REMOTE_TID : RTEMS.ID; + +-- +-- This variable contains the node on which the remote task with which +-- this test interacts resides. +-- + + REMOTE_NODE : RTEMS.UNSIGNED32; + +-- +-- The number of events to process per dot printed out. +-- + + PER_DOT : constant RTEMS.UNSIGNED32 := 100; + +-- +-- INIT +-- +-- DESCRIPTION: +-- +-- This RTEMS task initializes the application. +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ); + +-- +-- TEST_TASK +-- +-- DESCRIPTION: +-- +-- This is the body of the RTEMS tasks which constitute this test. +-- + + procedure TEST_TASK ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ); + +-- +-- This is the Driver Address Table for this test. +-- + + DEVICE_DRIVERS : aliased RTEMS.DRIVER_ADDRESS_TABLE( 1 .. 1 ) := + (1=> + ( + CLOCK_DRIVER.INITIALIZE'ACCESS, -- Initialization + RTEMS.NO_DRIVER_ENTRY, -- Open + RTEMS.NO_DRIVER_ENTRY, -- Close + RTEMS.NO_DRIVER_ENTRY, -- Read + RTEMS.NO_DRIVER_ENTRY, -- Write + RTEMS.NO_DRIVER_ENTRY -- Control + ) + ); + +-- +-- This is the Initialization Tasks Table for this test. +-- + + INITIALIZATION_TASKS : aliased RTEMS.INITIALIZATION_TASKS_TABLE( 1 .. 1 ) := + (1=> + ( + RTEMS.BUILD_NAME( 'U', 'I', '1', ' ' ), -- task name + 2048, -- stack size + 1, -- priority + RTEMS.DEFAULT_ATTRIBUTES, -- attributes + MPTEST.INIT'ACCESS, -- entry point + RTEMS.NO_PREEMPT, -- initial mode + 0 -- argument list + ) + ); + +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- +-- BEGIN SUBPACKAGE -- +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- + + -- + -- MPTEST.PER_NODE_CONFIGURATION / SPECIFICATION + -- + -- DESCRIPTION: + -- + -- This package is the specification for the subpackage + -- which will define the per node configuration parameters. + -- + + package PER_NODE_CONFIGURATION is + + -- + -- LOCAL_NODE_NUMBER + -- + -- DESCRIPTION: + -- + -- This function returns the node number for this node. + -- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32; + + pragma INLINE ( LOCAL_NODE_NUMBER ); + + end PER_NODE_CONFIGURATION; + +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- +-- END SUBPACKAGE -- +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- + +-- +-- This is the Multiprocessor Configuration Table for this test. +-- + + MULTIPROCESSING_CONFIGURATION : aliased RTEMS.MULTIPROCESSING_TABLE := ( + MPTEST.PER_NODE_CONFIGURATION.LOCAL_NODE_NUMBER, + 2, -- maximum # nodes in system + 32, -- maximum # global objects + 32 -- maximum # proxies + ); + +-- +-- This is the Configuration Table for this test. +-- + + CONFIGURATION : aliased RTEMS.CONFIGURATION_TABLE := ( + RTEMS.NULL_ADDRESS, -- will be replaced by BSP + 64 * 1024, -- executive RAM size + 10, -- maximum # tasks + 1, -- maximum # timers + 1, -- maximum # semaphores + 0, -- maximum # message queues + 0, -- maximum # messages + 0, -- maximum # partitions + 0, -- maximum # regions + 0, -- maximum # dp memory areas + 0, -- maximum # periods + 0, -- maximum # user extensions + RTEMS.MILLISECONDS_TO_MICROSECONDS(10), -- # us in a tick + 50 -- # ticks in a timeslice + ); + +end MPTEST; diff --git a/c/src/ada-tests/mptests/mp08/node1/mptest-per_node_configuration.adb b/c/src/ada-tests/mptests/mp08/node1/mptest-per_node_configuration.adb new file mode 100644 index 0000000000..c68217932a --- /dev/null +++ b/c/src/ada-tests/mptests/mp08/node1/mptest-per_node_configuration.adb @@ -0,0 +1,43 @@ +-- +-- MPTEST.PER_NODE_CONFIGURATION / BODY +-- +-- DESCRIPTION: +-- +-- This package is the specification for the subpackage +-- which will define the per node configuration parameters. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest-per_node_configuration.adb,v 1.2 1995/05/31 16:34:19 joel Exp +-- + +with RTEMS; + +separate ( MPTEST ) + +package body PER_NODE_CONFIGURATION is + +--PAGE +-- +-- LOCAL_NODE_NUMBER +-- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32 is + begin + + return 1; + + end LOCAL_NODE_NUMBER; + +end PER_NODE_CONFIGURATION; diff --git a/c/src/ada-tests/mptests/mp08/node2/mptest-per_node_configuration.adb b/c/src/ada-tests/mptests/mp08/node2/mptest-per_node_configuration.adb new file mode 100644 index 0000000000..8585d960fd --- /dev/null +++ b/c/src/ada-tests/mptests/mp08/node2/mptest-per_node_configuration.adb @@ -0,0 +1,43 @@ +-- +-- MPTEST.PER_NODE_CONFIGURATION / BODY +-- +-- DESCRIPTION: +-- +-- This package is the specification for the subpackage +-- which will define the per node configuration parameters. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest-per_node_configuration.adb,v 1.2 1995/05/31 16:34:30 joel Exp +-- + +with RTEMS; + +separate ( MPTEST ) + +package body PER_NODE_CONFIGURATION is + +--PAGE +-- +-- LOCAL_NODE_NUMBER +-- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32 is + begin + + return 2; + + end LOCAL_NODE_NUMBER; + +end PER_NODE_CONFIGURATION; diff --git a/c/src/ada-tests/mptests/mp09/mptest.adb b/c/src/ada-tests/mptests/mp09/mptest.adb new file mode 100644 index 0000000000..cdfc4734d2 --- /dev/null +++ b/c/src/ada-tests/mptests/mp09/mptest.adb @@ -0,0 +1,381 @@ +-- +-- MPTEST / BODY +-- +-- DESCRIPTION: +-- +-- This package is the implementation for Test 9 of the RTEMS +-- Multiprocessor Test Suite. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest.adb,v 1.3 1995/07/12 19:39:46 joel Exp +-- + +with INTERFACES; use INTERFACES; +with RTEMS; +with TEST_SUPPORT; +with TEXT_IO; +with UNSIGNED32_IO; + +package body MPTEST is + + package body PER_NODE_CONFIGURATION is separate; + +--PAGE +-- +-- INIT +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ) is + STATUS : RTEMS.STATUS_CODES; + begin + + TEXT_IO.NEW_LINE( 2 ); + TEXT_IO.PUT( "*** TEST 9 -- NODE " ); + UNSIGNED32_IO.PUT( + MPTEST.MULTIPROCESSING_CONFIGURATION.NODE, + WIDTH => 1 + ); + TEXT_IO.PUT_LINE( " ***" ); + + MPTEST.RECEIVE_BUFFER := + RTEMS.TO_BUFFER_POINTER( MPTEST.RECEIVE_BUFFER_AREA'ADDRESS ); + + MPTEST.BUFFER_1 := + RTEMS.TO_BUFFER_POINTER( MPTEST.BUFFER_AREA_1'ADDRESS ); + + MPTEST.BUFFER_2 := + RTEMS.TO_BUFFER_POINTER( MPTEST.BUFFER_AREA_2'ADDRESS ); + + MPTEST.BUFFER_3 := + RTEMS.TO_BUFFER_POINTER( MPTEST.BUFFER_AREA_3'ADDRESS ); + + MPTEST.BUFFER_4 := + RTEMS.TO_BUFFER_POINTER( MPTEST.BUFFER_AREA_4'ADDRESS ); + + MPTEST.FILL_BUFFER( "123456789012345 ", MPTEST.BUFFER_AREA_1 ); + MPTEST.FILL_BUFFER( "abcdefghijklmno ", MPTEST.BUFFER_AREA_2 ); + MPTEST.FILL_BUFFER( "ABCDEFGHIJKLMNO ", MPTEST.BUFFER_AREA_3 ); + MPTEST.FILL_BUFFER( "PQRSTUVWXYZ(){} ", MPTEST.BUFFER_AREA_4 ); + + MPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( '1', '1', '1', ' ' ); + MPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( '2', '2', '2', ' ' ); + + MPTEST.QUEUE_NAME( 1 ) := RTEMS.BUILD_NAME( 'M', 'S', 'G', ' ' ); + + if MPTEST.MULTIPROCESSING_CONFIGURATION.NODE = 1 then + + TEXT_IO.PUT_LINE( "Creating Message Queue (Global)" ); + RTEMS.MESSAGE_QUEUE_CREATE( + MPTEST.QUEUE_NAME( 1 ), + 3, + RTEMS.GLOBAL + RTEMS.LIMIT, + MPTEST.QUEUE_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_CREATE" ); + + end if; + + TEXT_IO.PUT_LINE( "Creating Test_task (local)" ); + RTEMS.TASK_CREATE( + MPTEST.TASK_NAME( MPTEST.MULTIPROCESSING_CONFIGURATION.NODE ), + MPTEST.MULTIPROCESSING_CONFIGURATION.NODE, + 2048, + RTEMS.TIMESLICE, + RTEMS.DEFAULT_ATTRIBUTES, + MPTEST.TASK_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" ); + + TEXT_IO.PUT_LINE( "Starting Test_task (local)" ); + RTEMS.TASK_START( + MPTEST.TASK_ID( 1 ), + MPTEST.TEST_TASK'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" ); + + TEXT_IO.PUT_LINE( "Deleting initialization task" ); + RTEMS.TASK_DELETE( RTEMS.SELF, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" ); + + end INIT; + +--PAGE +-- +-- SEND_MESSAGES +-- + + procedure SEND_MESSAGES is + BROADCAST_COUNT : RTEMS.UNSIGNED32; + STATUS : RTEMS.STATUS_CODES; + begin + + TEXT_IO.PUT( "message_queue_send : " ); + MPTEST.PUT_BUFFER( MPTEST.BUFFER_AREA_1 ); + TEXT_IO.NEW_LINE; + + RTEMS.MESSAGE_QUEUE_SEND( + MPTEST.QUEUE_ID( 1 ), + MPTEST.BUFFER_1, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_SEND" ); + + TEXT_IO.PUT_LINE( "Delaying for a second" ); + RTEMS.TASK_WAKE_AFTER( + 1 * TEST_SUPPORT.TICKS_PER_SECOND, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + TEXT_IO.PUT( "message_queue_urgent : " ); + MPTEST.PUT_BUFFER( MPTEST.BUFFER_AREA_2 ); + TEXT_IO.NEW_LINE; + + RTEMS.MESSAGE_QUEUE_URGENT( + MPTEST.QUEUE_ID( 1 ), + MPTEST.BUFFER_2, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_URGENT" ); + + TEXT_IO.PUT_LINE( "Delaying for a second" ); + RTEMS.TASK_WAKE_AFTER( + 1 * TEST_SUPPORT.TICKS_PER_SECOND, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + TEXT_IO.PUT( "message_queue_broadcast : " ); + MPTEST.PUT_BUFFER( MPTEST.BUFFER_AREA_3 ); + TEXT_IO.NEW_LINE; + + RTEMS.MESSAGE_QUEUE_BROADCAST( + MPTEST.QUEUE_ID( 1 ), + MPTEST.BUFFER_3, + BROADCAST_COUNT, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_BROADCAST" ); + + TEXT_IO.PUT_LINE( "Delaying for a second" ); + RTEMS.TASK_WAKE_AFTER( + 1 * TEST_SUPPORT.TICKS_PER_SECOND, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + end SEND_MESSAGES; + +--PAGE +-- +-- RECEIVE_MESSAGES +-- + + procedure RECEIVE_MESSAGES is + INDEX : RTEMS.UNSIGNED32; + STATUS : RTEMS.STATUS_CODES; + begin + + for INDEX in 1 .. 3 + loop + + TEXT_IO.PUT_LINE( "Receiving message ..." ); + RTEMS.MESSAGE_QUEUE_RECEIVE( + MPTEST.QUEUE_ID( 1 ), + MPTEST.RECEIVE_BUFFER, + RTEMS.DEFAULT_OPTIONS, + RTEMS.NO_TIMEOUT, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_RECEIVE" ); + + TEXT_IO.PUT( "Received : " ); + MPTEST.PUT_BUFFER( MPTEST.RECEIVE_BUFFER_AREA ); + TEXT_IO.NEW_LINE; + + end loop; + + TEXT_IO.PUT_LINE( "Receiver delaying for a second" ); + + RTEMS.TASK_WAKE_AFTER( 1 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + end RECEIVE_MESSAGES; + +--PAGE +-- +-- FILL_BUFFER +-- + +-- +-- Depends on tricks to make the copy work. +-- + + procedure FILL_BUFFER ( + SOURCE : in STRING; + BUFFER : out RTEMS.BUFFER + ) is + SOURCE_BUFFER : RTEMS.BUFFER_POINTER; + begin + + SOURCE_BUFFER := RTEMS.TO_BUFFER_POINTER( + SOURCE( SOURCE'FIRST )'ADDRESS + ); + + BUFFER.FIELD1 := SOURCE_BUFFER.FIELD1; + BUFFER.FIELD2 := SOURCE_BUFFER.FIELD2; + BUFFER.FIELD3 := SOURCE_BUFFER.FIELD3; + BUFFER.FIELD4 := SOURCE_BUFFER.FIELD4; + + end FILL_BUFFER; + +--PAGE +-- +-- PUT_BUFFER +-- + +-- +-- Depends on tricks to make the output work. +-- + + procedure PUT_BUFFER ( + BUFFER : in RTEMS.BUFFER + ) is + begin + + TEST_SUPPORT.PUT_NAME( BUFFER.FIELD1, FALSE ); + TEST_SUPPORT.PUT_NAME( BUFFER.FIELD2, FALSE ); + TEST_SUPPORT.PUT_NAME( BUFFER.FIELD3, FALSE ); + TEST_SUPPORT.PUT_NAME( BUFFER.FIELD4, FALSE ); + + end PUT_BUFFER; + +--PAGE +-- +-- TEST_TASK +-- + + procedure TEST_TASK ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ) is + COUNT : RTEMS.UNSIGNED32; + STATUS : RTEMS.STATUS_CODES; + begin + + RTEMS.TASK_WAKE_AFTER( 1 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + TEXT_IO.PUT_LINE( "Getting QID of message queue" ); + + loop + + RTEMS.MESSAGE_QUEUE_IDENT( + MPTEST.QUEUE_NAME( 1 ), + RTEMS.SEARCH_ALL_NODES, + MPTEST.QUEUE_ID( 1 ), + STATUS + ); + + exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS ); + + end loop; + + if MPTEST.MULTIPROCESSING_CONFIGURATION.NODE = 2 then + + RTEMS.MESSAGE_QUEUE_DELETE( MPTEST.QUEUE_ID( 1 ), STATUS ); + + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.ILLEGAL_ON_REMOTE_OBJECT, + "MESSAGE_QUEUE_DELETE" + ); + + TEXT_IO.PUT_LINE( + "message_queue_delete correctly returned ILLEGAL_ON_REMOTE_OBJECT" + ); + + MPTEST.SEND_MESSAGES; + + MPTEST.RECEIVE_MESSAGES; + + TEXT_IO.PUT_LINE( "Flushing remote empty queue" ); + RTEMS.MESSAGE_QUEUE_FLUSH( MPTEST.QUEUE_ID( 1 ), COUNT, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_FLUSH" ); + UNSIGNED32_IO.PUT( COUNT, WIDTH => 1 ); + TEXT_IO.PUT_LINE( + " messages were flushed from remote empty queue" + ); + + TEXT_IO.PUT_LINE( + "Send messages to be flushed from remote queue" + ); + RTEMS.MESSAGE_QUEUE_SEND( + MPTEST.QUEUE_ID( 1 ), + MPTEST.BUFFER_1, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_SEND" ); + + TEXT_IO.PUT_LINE( "Flushing remote queue" ); + RTEMS.MESSAGE_QUEUE_FLUSH( MPTEST.QUEUE_ID( 1 ), COUNT, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_FLUSH" ); + UNSIGNED32_IO.PUT( COUNT, WIDTH => 1 ); + TEXT_IO.PUT_LINE( + " messages were flushed from the remote queue" + ); + + TEXT_IO.PUT_LINE( "Waiting for message queue to be deleted" ); + RTEMS.MESSAGE_QUEUE_RECEIVE( + MPTEST.QUEUE_ID( 1 ), + MPTEST.RECEIVE_BUFFER, + RTEMS.DEFAULT_OPTIONS, + RTEMS.NO_TIMEOUT, + STATUS + ); + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.OBJECT_WAS_DELETED, + "MESSAGE_QUEUE_FLUSH" + ); + + else + + MPTEST.RECEIVE_MESSAGES; + + MPTEST.SEND_MESSAGES; + + RTEMS.TASK_WAKE_AFTER( + 5 * TEST_SUPPORT.TICKS_PER_SECOND, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + RTEMS.MESSAGE_QUEUE_DELETE( MPTEST.QUEUE_ID( 1 ), STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_DELETE" ); + + end if; + + TEXT_IO.PUT_LINE( "*** END OF TEST 9 ***" ); + + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end TEST_TASK; + +end MPTEST; diff --git a/c/src/ada-tests/mptests/mp09/mptest.ads b/c/src/ada-tests/mptests/mp09/mptest.ads new file mode 100644 index 0000000000..36d8cf716d --- /dev/null +++ b/c/src/ada-tests/mptests/mp09/mptest.ads @@ -0,0 +1,255 @@ +-- +-- MPTEST / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package is the specification for Test 9 of the RTEMS +-- Multiprocessor Test Suite. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest.ads,v 1.3 1995/07/12 19:39:47 joel Exp +-- + +with CLOCK_DRIVER; +with BSP_MPCI; +with RTEMS; + +package MPTEST is + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS tasks created +-- by this test. +-- + + TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.ID; + TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.NAME; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS message +-- queues created by this test. +-- + + QUEUE_ID : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.ID; + QUEUE_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.NAME; + +-- +-- The following are message buffers used to contain the test messages +-- and pointers to those buffers. +-- + + RECEIVE_BUFFER_AREA : RTEMS.BUFFER; + BUFFER_AREA_1 : RTEMS.BUFFER; + BUFFER_AREA_2 : RTEMS.BUFFER; + BUFFER_AREA_3 : RTEMS.BUFFER; + BUFFER_AREA_4 : RTEMS.BUFFER; + + RECEIVE_BUFFER : RTEMS.BUFFER_POINTER; + BUFFER_1 : RTEMS.BUFFER_POINTER; + BUFFER_2 : RTEMS.BUFFER_POINTER; + BUFFER_3 : RTEMS.BUFFER_POINTER; + BUFFER_4 : RTEMS.BUFFER_POINTER; + +-- +-- This variable contains the ID of the remote task with which this +-- test interacts. +-- + + REMOTE_TID : RTEMS.ID; + +-- +-- This variable contains the node on which the remote task with which +-- this test interacts resides. +-- + + REMOTE_NODE : RTEMS.UNSIGNED32; + +-- +-- The number of events to process per dot printed out. +-- + + PER_DOT : constant RTEMS.UNSIGNED32 := 100; + +-- +-- INIT +-- +-- DESCRIPTION: +-- +-- This RTEMS task initializes the application. +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ); + +-- +-- SEND_MESSAGES +-- +-- This subprogram prints and sends a sequence of three test messages. +-- One of the messages is sent, one is urgent, and one is broadcast. +-- A one second pause is between each the sending of each message. +-- + + procedure SEND_MESSAGES; + +-- +-- RECEIVE_MESSAGES +-- +-- This subprogram receives and prints a sequence of three test messages. +-- + + procedure RECEIVE_MESSAGES; + +-- +-- FILL_BUFFER +-- +-- DESCRIPTION: +-- +-- This subprogram takes the SOURCE input string and places +-- up to the first sixteen characters of that string into +-- the message BUFFER. +-- + + procedure FILL_BUFFER ( + SOURCE : in STRING; + BUFFER : out RTEMS.BUFFER + ); + +-- +-- PUT_BUFFER +-- +-- DESCRIPTION: +-- +-- This subprogram prints the specified message BUFFER. +-- + + procedure PUT_BUFFER ( + BUFFER : in RTEMS.BUFFER + ); + +-- +-- TEST_TASK +-- +-- DESCRIPTION: +-- +-- This is the body of the RTEMS tasks which constitute this test. +-- + + procedure TEST_TASK ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ); + +-- +-- This is the Driver Address Table for this test. +-- + + DEVICE_DRIVERS : aliased RTEMS.DRIVER_ADDRESS_TABLE( 1 .. 1 ) := + (1=> + ( + CLOCK_DRIVER.INITIALIZE'ACCESS, -- Initialization + RTEMS.NO_DRIVER_ENTRY, -- Open + RTEMS.NO_DRIVER_ENTRY, -- Close + RTEMS.NO_DRIVER_ENTRY, -- Read + RTEMS.NO_DRIVER_ENTRY, -- Write + RTEMS.NO_DRIVER_ENTRY -- Control + ) + ); + +-- +-- This is the Initialization Tasks Table for this test. +-- + + INITIALIZATION_TASKS : aliased RTEMS.INITIALIZATION_TASKS_TABLE( 1 .. 1 ) := + (1=> + ( + RTEMS.BUILD_NAME( 'U', 'I', '1', ' ' ), -- task name + 2048, -- stack size + 1, -- priority + RTEMS.DEFAULT_ATTRIBUTES, -- attributes + MPTEST.INIT'ACCESS, -- entry point + RTEMS.NO_PREEMPT, -- initial mode + 0 -- argument list + ) + ); + +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- +-- BEGIN SUBPACKAGE -- +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- + + -- + -- MPTEST.PER_NODE_CONFIGURATION / SPECIFICATION + -- + -- DESCRIPTION: + -- + -- This package is the specification for the subpackage + -- which will define the per node configuration parameters. + -- + + package PER_NODE_CONFIGURATION is + + -- + -- LOCAL_NODE_NUMBER + -- + -- DESCRIPTION: + -- + -- This function returns the node number for this node. + -- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32; + + pragma INLINE ( LOCAL_NODE_NUMBER ); + + end PER_NODE_CONFIGURATION; + +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- +-- END SUBPACKAGE -- +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- + +-- +-- This is the Multiprocessor Configuration Table for this test. +-- + + MULTIPROCESSING_CONFIGURATION : aliased RTEMS.MULTIPROCESSING_TABLE := ( + MPTEST.PER_NODE_CONFIGURATION.LOCAL_NODE_NUMBER, + 2, -- maximum # nodes in system + 32, -- maximum # global objects + 32 -- maximum # proxies + ); + +-- +-- This is the Configuration Table for this test. +-- + + CONFIGURATION : aliased RTEMS.CONFIGURATION_TABLE := ( + RTEMS.NULL_ADDRESS, -- will be replaced by BSP + 64 * 1024, -- executive RAM size + 10, -- maximum # tasks + 0, -- maximum # timers + 0, -- maximum # semaphores + 1, -- maximum # message queues + 1, -- maximum # messages + 0, -- maximum # partitions + 0, -- maximum # regions + 0, -- maximum # dp memory areas + 0, -- maximum # periods + 0, -- maximum # user extensions + RTEMS.MILLISECONDS_TO_MICROSECONDS(10), -- # us in a tick + 50 -- # ticks in a timeslice + ); + +end MPTEST; diff --git a/c/src/ada-tests/mptests/mp09/node1/mptest-per_node_configuration.adb b/c/src/ada-tests/mptests/mp09/node1/mptest-per_node_configuration.adb new file mode 100644 index 0000000000..e8889932b4 --- /dev/null +++ b/c/src/ada-tests/mptests/mp09/node1/mptest-per_node_configuration.adb @@ -0,0 +1,43 @@ +-- +-- MPTEST.PER_NODE_CONFIGURATION / BODY +-- +-- DESCRIPTION: +-- +-- This package is the specification for the subpackage +-- which will define the per node configuration parameters. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest-per_node_configuration.adb,v 1.2 1995/05/31 16:34:34 joel Exp +-- + +with RTEMS; + +separate ( MPTEST ) + +package body PER_NODE_CONFIGURATION is + +--PAGE +-- +-- LOCAL_NODE_NUMBER +-- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32 is + begin + + return 1; + + end LOCAL_NODE_NUMBER; + +end PER_NODE_CONFIGURATION; diff --git a/c/src/ada-tests/mptests/mp09/node2/mptest-per_node_configuration.adb b/c/src/ada-tests/mptests/mp09/node2/mptest-per_node_configuration.adb new file mode 100644 index 0000000000..b1ebe4c350 --- /dev/null +++ b/c/src/ada-tests/mptests/mp09/node2/mptest-per_node_configuration.adb @@ -0,0 +1,43 @@ +-- +-- MPTEST.PER_NODE_CONFIGURATION / BODY +-- +-- DESCRIPTION: +-- +-- This package is the specification for the subpackage +-- which will define the per node configuration parameters. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest-per_node_configuration.adb,v 1.2 1995/05/31 16:34:45 joel Exp +-- + +with RTEMS; + +separate ( MPTEST ) + +package body PER_NODE_CONFIGURATION is + +--PAGE +-- +-- LOCAL_NODE_NUMBER +-- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32 is + begin + + return 2; + + end LOCAL_NODE_NUMBER; + +end PER_NODE_CONFIGURATION; diff --git a/c/src/ada-tests/mptests/mp10/mptest.adb b/c/src/ada-tests/mptests/mp10/mptest.adb new file mode 100644 index 0000000000..0c29de4bfd --- /dev/null +++ b/c/src/ada-tests/mptests/mp10/mptest.adb @@ -0,0 +1,301 @@ +-- +-- MPTEST / BODY +-- +-- DESCRIPTION: +-- +-- This package is the implementation for Test 10 of the RTEMS +-- Multiprocessor Test Suite. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest.adb,v 1.3 1995/07/12 19:39:54 joel Exp +-- + +with INTERFACES; use INTERFACES; +with RTEMS; +with TEST_SUPPORT; +with TEXT_IO; +with UNSIGNED32_IO; + +package body MPTEST is + + package body PER_NODE_CONFIGURATION is separate; + +--PAGE +-- +-- INIT +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ) is + STATUS : RTEMS.STATUS_CODES; + begin + + TEXT_IO.NEW_LINE( 2 ); + TEXT_IO.PUT( "*** TEST 10 -- NODE " ); + UNSIGNED32_IO.PUT( + MPTEST.MULTIPROCESSING_CONFIGURATION.NODE, + WIDTH => 1 + ); + TEXT_IO.PUT_LINE( " ***" ); + + + MPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'A', '1', ' ' ); + MPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( 'T', 'A', '2', ' ' ); + MPTEST.TASK_NAME( 3 ) := RTEMS.BUILD_NAME( 'S', 'A', '3', ' ' ); + + MPTEST.QUEUE_NAME( 1 ) := RTEMS.BUILD_NAME( 'M', 'S', 'G', ' ' ); + + MPTEST.SEMAPHORE_NAME( 1 ) := RTEMS.BUILD_NAME( 'S', 'E', 'M', ' ' ); + + if MPTEST.MULTIPROCESSING_CONFIGURATION.NODE = 1 then + + TEXT_IO.PUT_LINE( "Creating Message Queue (Global)" ); + RTEMS.MESSAGE_QUEUE_CREATE( + MPTEST.QUEUE_NAME( 1 ), + 3, + RTEMS.GLOBAL + RTEMS.LIMIT, + MPTEST.QUEUE_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_CREATE" ); + + TEXT_IO.PUT_LINE( "Creating Semaphore (Global)" ); + RTEMS.SEMAPHORE_CREATE( + MPTEST.SEMAPHORE_NAME( 1 ), + 0, + RTEMS.GLOBAL + RTEMS.PRIORITY, + MPTEST.SEMAPHORE_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_CREATE" ); + + RTEMS.TASK_WAKE_AFTER( 10 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + else + + TEXT_IO.PUT_LINE( "Creating Test_task 1 (local)" ); + RTEMS.TASK_CREATE( + MPTEST.TASK_NAME( 1 ), + 1, + 2048, + RTEMS.TIMESLICE, + RTEMS.DEFAULT_ATTRIBUTES, + MPTEST.TASK_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" ); + + TEXT_IO.PUT_LINE( "Starting Test_task 1 (local)" ); + RTEMS.TASK_START( + MPTEST.TASK_ID( 1 ), + MPTEST.TEST_TASK_1'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" ); + + TEXT_IO.PUT_LINE( "Creating Test_task 2 (local)" ); + RTEMS.TASK_CREATE( + MPTEST.TASK_NAME( 2 ), + 1, + 2048, + RTEMS.TIMESLICE, + RTEMS.DEFAULT_ATTRIBUTES, + MPTEST.TASK_ID( 2 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" ); + + TEXT_IO.PUT_LINE( "Starting Test_task 2 (local)" ); + RTEMS.TASK_START( + MPTEST.TASK_ID( 2 ), + MPTEST.TEST_TASK_2'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" ); + + TEXT_IO.PUT_LINE( "Creating Test_task 3 (local)" ); + RTEMS.TASK_CREATE( + MPTEST.TASK_NAME( 3 ), + 1, + 2048, + RTEMS.TIMESLICE, + RTEMS.DEFAULT_ATTRIBUTES, + MPTEST.TASK_ID( 3 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" ); + + TEXT_IO.PUT_LINE( "Starting Test_task 3 (local)" ); + RTEMS.TASK_START( + MPTEST.TASK_ID( 3 ), + MPTEST.TEST_TASK_3'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" ); + + TEXT_IO.PUT_LINE( "Sleeping for 1 second ..." ); + RTEMS.TASK_WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + TEXT_IO.PUT_LINE( "Deleting Test_task 2" ); + RTEMS.TASK_DELETE( MPTEST.TASK_ID( 2 ), STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF 2" ); + + TEXT_IO.PUT_LINE( "Deleting Test_task 1" ); + RTEMS.TASK_DELETE( MPTEST.TASK_ID( 1 ), STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF 1" ); + + TEXT_IO.PUT_LINE( "Restarting Test_task 3" ); + RTEMS.TASK_RESTART( MPTEST.TASK_ID( 3 ), 1, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_RESTART OF 3" ); + + end if; + + TEXT_IO.PUT_LINE( "*** END OF TEST 10 ***" ); + + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end INIT; + +--PAGE +-- +-- TEST_TASK_1 +-- + + procedure TEST_TASK_1 ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ) is + COUNT : RTEMS.UNSIGNED32; + RECEIVE_BUFFER_AREA : RTEMS.BUFFER; + RECEIVE_BUFFER : RTEMS.BUFFER_POINTER; + STATUS : RTEMS.STATUS_CODES; + begin + + RECEIVE_BUFFER := + RTEMS.TO_BUFFER_POINTER( RECEIVE_BUFFER_AREA'ADDRESS ); + + TEXT_IO.PUT_LINE( "Getting QID of message queue" ); + + loop + + RTEMS.MESSAGE_QUEUE_IDENT( + MPTEST.QUEUE_NAME( 1 ), + RTEMS.SEARCH_ALL_NODES, + MPTEST.QUEUE_ID( 1 ), + STATUS + ); + + exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS ); + + end loop; + + TEXT_IO.PUT_LINE( "Attempting to receive message ..." ); + RTEMS.MESSAGE_QUEUE_RECEIVE( + MPTEST.QUEUE_ID( 1 ), + RECEIVE_BUFFER, + RTEMS.DEFAULT_OPTIONS, + RTEMS.NO_TIMEOUT, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_RECEIVE" ); + + end TEST_TASK_1; + +--PAGE +-- +-- TEST_TASK_2 +-- + + procedure TEST_TASK_2 ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ) is + STATUS : RTEMS.STATUS_CODES; + begin + + TEXT_IO.PUT_LINE( "Getting SMID of semaphore" ); + + loop + + RTEMS.SEMAPHORE_IDENT( + MPTEST.SEMAPHORE_NAME( 1 ), + RTEMS.SEARCH_ALL_NODES, + MPTEST.SEMAPHORE_ID( 1 ), + STATUS + ); + + exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS ); + + end loop; + + TEXT_IO.PUT_LINE( "Attempting to acquire semaphore ..." ); + RTEMS.SEMAPHORE_OBTAIN( + MPTEST.SEMAPHORE_ID( 1 ), + RTEMS.DEFAULT_OPTIONS, + RTEMS.NO_TIMEOUT, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_OBTAIN" ); + + end TEST_TASK_2; + +--PAGE +-- +-- TEST_TASK_3 +-- + + procedure TEST_TASK_3 ( + RESTART : in RTEMS.TASK_ARGUMENT + ) is + STATUS : RTEMS.STATUS_CODES; + begin + + if RESTART = 1 then + + RTEMS.TASK_DELETE( RTEMS.SELF, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE" ); + + end if; + + TEXT_IO.PUT_LINE( "Getting SMID of semaphore" ); + + loop + + RTEMS.SEMAPHORE_IDENT( + MPTEST.SEMAPHORE_NAME( 1 ), + RTEMS.SEARCH_ALL_NODES, + MPTEST.SEMAPHORE_ID( 1 ), + STATUS + ); + + exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS ); + + end loop; + + TEXT_IO.PUT_LINE( "Attempting to acquire semaphore ..." ); + RTEMS.SEMAPHORE_OBTAIN( + MPTEST.SEMAPHORE_ID( 1 ), + RTEMS.DEFAULT_OPTIONS, + RTEMS.NO_TIMEOUT, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_OBTAIN" ); + + end TEST_TASK_3; + +end MPTEST; diff --git a/c/src/ada-tests/mptests/mp10/mptest.ads b/c/src/ada-tests/mptests/mp10/mptest.ads new file mode 100644 index 0000000000..d2a6692025 --- /dev/null +++ b/c/src/ada-tests/mptests/mp10/mptest.ads @@ -0,0 +1,225 @@ +-- +-- MPTEST / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package is the specification for Test 10 of the RTEMS +-- Multiprocessor Test Suite. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest.ads,v 1.3 1995/07/12 19:39:54 joel Exp +-- + +with CLOCK_DRIVER; +with BSP_MPCI; +with RTEMS; + +package MPTEST is + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS tasks created +-- by this test. +-- + + TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.ID; + TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.NAME; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS message +-- queues created by this test. +-- + + QUEUE_ID : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.ID; + QUEUE_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.NAME; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS semaphore +-- created by this test. +-- + + SEMAPHORE_ID : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.ID; + SEMAPHORE_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.NAME; + +-- +-- This variable contains the ID of the remote task with which this +-- test interacts. +-- + + REMOTE_TID : RTEMS.ID; + +-- +-- This variable contains the node on which the remote task with which +-- this test interacts resides. +-- + + REMOTE_NODE : RTEMS.UNSIGNED32; + +-- +-- The number of events to process per dot printed out. +-- + + PER_DOT : constant RTEMS.UNSIGNED32 := 100; + +-- +-- INIT +-- +-- DESCRIPTION: +-- +-- This RTEMS task initializes the application. +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ); + +-- +-- TEST_TASK_1 +-- +-- DESCRIPTION: +-- +-- This is the body of one of the RTEMS tasks which constitute this test. +-- + + procedure TEST_TASK_1 ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ); + +-- +-- TEST_TASK_2 +-- +-- DESCRIPTION: +-- +-- This is the body of one of the RTEMS tasks which constitute this test. +-- + + procedure TEST_TASK_2 ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ); + +-- +-- TEST_TASK_3 +-- +-- DESCRIPTION: +-- +-- This is the body of one of the RTEMS tasks which constitute this test. +-- + + procedure TEST_TASK_3 ( + RESTART : in RTEMS.TASK_ARGUMENT + ); + +-- +-- This is the Driver Address Table for this test. +-- + + DEVICE_DRIVERS : aliased RTEMS.DRIVER_ADDRESS_TABLE( 1 .. 1 ) := + (1=> + ( + CLOCK_DRIVER.INITIALIZE'ACCESS, -- Initialization + RTEMS.NO_DRIVER_ENTRY, -- Open + RTEMS.NO_DRIVER_ENTRY, -- Close + RTEMS.NO_DRIVER_ENTRY, -- Read + RTEMS.NO_DRIVER_ENTRY, -- Write + RTEMS.NO_DRIVER_ENTRY -- Control + ) + ); + +-- +-- This is the Initialization Tasks Table for this test. +-- + + INITIALIZATION_TASKS : aliased RTEMS.INITIALIZATION_TASKS_TABLE( 1 .. 1 ) := + (1=> + ( + RTEMS.BUILD_NAME( 'U', 'I', '1', ' ' ), -- task name + 2048, -- stack size + 1, -- priority + RTEMS.DEFAULT_ATTRIBUTES, -- attributes + MPTEST.INIT'ACCESS, -- entry point + RTEMS.NO_PREEMPT, -- initial mode + 0 -- argument list + ) + ); + +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- +-- BEGIN SUBPACKAGE -- +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- + + -- + -- MPTEST.PER_NODE_CONFIGURATION / SPECIFICATION + -- + -- DESCRIPTION: + -- + -- This package is the specification for the subpackage + -- which will define the per node configuration parameters. + -- + + package PER_NODE_CONFIGURATION is + + -- + -- LOCAL_NODE_NUMBER + -- + -- DESCRIPTION: + -- + -- This function returns the node number for this node. + -- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32; + + pragma INLINE ( LOCAL_NODE_NUMBER ); + + end PER_NODE_CONFIGURATION; + +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- +-- END SUBPACKAGE -- +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- + +-- +-- This is the Multiprocessor Configuration Table for this test. +-- + + MULTIPROCESSING_CONFIGURATION : aliased RTEMS.MULTIPROCESSING_TABLE := ( + MPTEST.PER_NODE_CONFIGURATION.LOCAL_NODE_NUMBER, + 2, -- maximum # nodes in system + 32, -- maximum # global objects + 32 -- maximum # proxies + ); + +-- +-- This is the Configuration Table for this test. +-- + + CONFIGURATION : aliased RTEMS.CONFIGURATION_TABLE := ( + RTEMS.NULL_ADDRESS, -- will be replaced by BSP + 64 * 1024, -- executive RAM size + 10, -- maximum # tasks + 0, -- maximum # timers + 1, -- maximum # semaphores + 1, -- maximum # message queues + 0, -- maximum # messages + 0, -- maximum # partitions + 0, -- maximum # regions + 0, -- maximum # dp memory areas + 0, -- maximum # periods + 0, -- maximum # user extensions + RTEMS.MILLISECONDS_TO_MICROSECONDS(10), -- # us in a tick + 50 -- # ticks in a timeslice + ); + +end MPTEST; diff --git a/c/src/ada-tests/mptests/mp10/node1/mptest-per_node_configuration.adb b/c/src/ada-tests/mptests/mp10/node1/mptest-per_node_configuration.adb new file mode 100644 index 0000000000..bad528865f --- /dev/null +++ b/c/src/ada-tests/mptests/mp10/node1/mptest-per_node_configuration.adb @@ -0,0 +1,43 @@ +-- +-- MPTEST.PER_NODE_CONFIGURATION / BODY +-- +-- DESCRIPTION: +-- +-- This package is the specification for the subpackage +-- which will define the per node configuration parameters. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest-per_node_configuration.adb,v 1.2 1995/05/31 16:34:49 joel Exp +-- + +with RTEMS; + +separate ( MPTEST ) + +package body PER_NODE_CONFIGURATION is + +--PAGE +-- +-- LOCAL_NODE_NUMBER +-- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32 is + begin + + return 1; + + end LOCAL_NODE_NUMBER; + +end PER_NODE_CONFIGURATION; diff --git a/c/src/ada-tests/mptests/mp10/node2/mptest-per_node_configuration.adb b/c/src/ada-tests/mptests/mp10/node2/mptest-per_node_configuration.adb new file mode 100644 index 0000000000..5ec62cf884 --- /dev/null +++ b/c/src/ada-tests/mptests/mp10/node2/mptest-per_node_configuration.adb @@ -0,0 +1,43 @@ +-- +-- MPTEST.PER_NODE_CONFIGURATION / BODY +-- +-- DESCRIPTION: +-- +-- This package is the specification for the subpackage +-- which will define the per node configuration parameters. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest-per_node_configuration.adb,v 1.2 1995/05/31 16:34:59 joel Exp +-- + +with RTEMS; + +separate ( MPTEST ) + +package body PER_NODE_CONFIGURATION is + +--PAGE +-- +-- LOCAL_NODE_NUMBER +-- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32 is + begin + + return 2; + + end LOCAL_NODE_NUMBER; + +end PER_NODE_CONFIGURATION; diff --git a/c/src/ada-tests/mptests/mp11/mptest.adb b/c/src/ada-tests/mptests/mp11/mptest.adb new file mode 100644 index 0000000000..3056b4da52 --- /dev/null +++ b/c/src/ada-tests/mptests/mp11/mptest.adb @@ -0,0 +1,138 @@ +-- +-- MPTEST / BODY +-- +-- DESCRIPTION: +-- +-- This package is the implementation for Test 11 of the RTEMS +-- Multiprocessor Test Suite. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest.adb,v 1.2 1995/05/31 16:35:09 joel Exp +-- + +with INTERFACES; use INTERFACES; +with RTEMS; +with TEST_SUPPORT; +with TEXT_IO; +with UNSIGNED32_IO; + +package body MPTEST is + + package body PER_NODE_CONFIGURATION is separate; + +--PAGE +-- +-- INIT +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ) is + STATUS : RTEMS.STATUS_CODES; + begin + + TEXT_IO.NEW_LINE( 2 ); + TEXT_IO.PUT( "*** TEST 11 -- NODE " ); + UNSIGNED32_IO.PUT( + MPTEST.MULTIPROCESSING_CONFIGURATION.NODE, + WIDTH => 1 + ); + TEXT_IO.PUT_LINE( " ***" ); + + MPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( '1', '1', '1', ' ' ); + MPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( '2', '2', '2', ' ' ); + + MPTEST.QUEUE_NAME( 1 ) := RTEMS.BUILD_NAME( 'M', 'S', 'G', ' ' ); + + MPTEST.SEMAPHORE_NAME( 1 ) := RTEMS.BUILD_NAME( 'S', 'E', 'M', ' ' ); + + MPTEST.PARTITION_NAME( 1 ) := RTEMS.BUILD_NAME( 'P', 'A', 'R', ' ' ); + + if MPTEST.MULTIPROCESSING_CONFIGURATION.NODE = 1 then + + TEXT_IO.PUT_LINE( "Attempting to create Test_task (Global)" ); + RTEMS.TASK_CREATE( + MPTEST.TASK_NAME( 1 ), + 1, + 2048, + RTEMS.DEFAULT_MODES, + RTEMS.GLOBAL, + MPTEST.TASK_ID( 1 ), + STATUS + ); + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.TOO_MANY, + "TASK_CREATE" + ); + TEXT_IO.PUT_LINE( "task_create correctly returned TOO_MANY" ); + + TEXT_IO.PUT_LINE( "Attempting to create Message Queue (Global)" ); + RTEMS.MESSAGE_QUEUE_CREATE( + MPTEST.QUEUE_NAME( 1 ), + 3, + RTEMS.GLOBAL + RTEMS.LIMIT, + MPTEST.QUEUE_ID( 1 ), + STATUS + ); + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.TOO_MANY, + "MESSAGE_QUEUE_CREATE" + ); + TEXT_IO.PUT_LINE( + "message_queue_create correctly returned TOO_MANY" + ); + + TEXT_IO.PUT_LINE( "Creating Semaphore (Global)" ); + RTEMS.SEMAPHORE_CREATE( + MPTEST.SEMAPHORE_NAME( 1 ), + 1, + RTEMS.GLOBAL, + MPTEST.SEMAPHORE_ID( 1 ), + STATUS + ); + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.TOO_MANY, + "SEMAPHORE_CREATE" + ); + TEXT_IO.PUT_LINE( "semaphore_create correctly returned TOO_MANY" ); + + TEXT_IO.PUT_LINE( "Creating Partition (Global)" ); + RTEMS.PARTITION_CREATE( + MPTEST.PARTITION_NAME( 1 ), + MPTEST.PARTITION_AREA( 0 )'ADDRESS, + 128, + 64, + RTEMS.GLOBAL, + MPTEST.PARTITION_ID( 1 ), + STATUS + ); + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.TOO_MANY, + "PARTITION_CREATE" + ); + TEXT_IO.PUT_LINE( "partition_create correctly returned TOO_MANY" ); + + end if; + + TEXT_IO.PUT_LINE( "*** END OF TEST 11 ***" ); + + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end INIT; + +end MPTEST; diff --git a/c/src/ada-tests/mptests/mp11/mptest.ads b/c/src/ada-tests/mptests/mp11/mptest.ads new file mode 100644 index 0000000000..815ef3598d --- /dev/null +++ b/c/src/ada-tests/mptests/mp11/mptest.ads @@ -0,0 +1,185 @@ +-- +-- MPTEST / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package is the specification for Test 11 of the RTEMS +-- Multiprocessor Test Suite. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest.ads,v 1.3 1995/07/12 19:40:02 joel Exp +-- + +with CLOCK_DRIVER; +with BSP_MPCI; +with RTEMS; + +package MPTEST is + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS tasks created +-- by this test. +-- + + TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.ID; + TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.NAME; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS message +-- queues created by this test. +-- + + QUEUE_ID : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.ID; + QUEUE_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.NAME; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS semaphore +-- created by this test. +-- + + SEMAPHORE_ID : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.ID; + SEMAPHORE_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.NAME; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS partition +-- created by this test. +-- + + PARTITION_ID : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.ID; + PARTITION_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.NAME; + +-- +-- This is the area used for the partition. +-- + + PARTITION_AREA : + array ( RTEMS.UNSIGNED32 range 0 .. 1023 ) of RTEMS.UNSIGNED8; + for PARTITION_AREA'ALIGNMENT use RTEMS.STRUCTURE_ALIGNMENT; + +-- +-- INIT +-- +-- DESCRIPTION: +-- +-- This RTEMS task initializes the application. +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ); + +-- +-- This is the Driver Address Table for this test. +-- + + DEVICE_DRIVERS : aliased RTEMS.DRIVER_ADDRESS_TABLE( 1 .. 1 ) := + (1=> + ( + CLOCK_DRIVER.INITIALIZE'ACCESS, -- Initialization + RTEMS.NO_DRIVER_ENTRY, -- Open + RTEMS.NO_DRIVER_ENTRY, -- Close + RTEMS.NO_DRIVER_ENTRY, -- Read + RTEMS.NO_DRIVER_ENTRY, -- Write + RTEMS.NO_DRIVER_ENTRY -- Control + ) + ); + +-- +-- This is the Initialization Tasks Table for this test. +-- + + INITIALIZATION_TASKS : aliased RTEMS.INITIALIZATION_TASKS_TABLE( 1 .. 1 ) := + (1=> + ( + RTEMS.BUILD_NAME( 'U', 'I', '1', ' ' ), -- task name + 2048, -- stack size + 1, -- priority + RTEMS.DEFAULT_ATTRIBUTES, -- attributes + MPTEST.INIT'ACCESS, -- entry point + RTEMS.NO_PREEMPT, -- initial mode + 0 -- argument list + ) + ); + +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- +-- BEGIN SUBPACKAGE -- +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- + + -- + -- MPTEST.PER_NODE_CONFIGURATION / SPECIFICATION + -- + -- DESCRIPTION: + -- + -- This package is the specification for the subpackage + -- which will define the per node configuration parameters. + -- + + package PER_NODE_CONFIGURATION is + + -- + -- LOCAL_NODE_NUMBER + -- + -- DESCRIPTION: + -- + -- This function returns the node number for this node. + -- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32; + + pragma INLINE ( LOCAL_NODE_NUMBER ); + + end PER_NODE_CONFIGURATION; + +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- +-- END SUBPACKAGE -- +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- + +-- +-- This is the Multiprocessor Configuration Table for this test. +-- + + MULTIPROCESSING_CONFIGURATION : aliased RTEMS.MULTIPROCESSING_TABLE := ( + MPTEST.PER_NODE_CONFIGURATION.LOCAL_NODE_NUMBER, + 2, -- maximum # nodes in system + 0, -- maximum # global objects + 0 -- maximum # proxies + ); + +-- +-- This is the Configuration Table for this test. +-- + + CONFIGURATION : aliased RTEMS.CONFIGURATION_TABLE := ( + RTEMS.NULL_ADDRESS, -- will be replaced by BSP + 64 * 1024, -- executive RAM size + 10, -- maximum # tasks + 0, -- maximum # timers + 1, -- maximum # semaphores + 1, -- maximum # message queues + 0, -- maximum # messages + 1, -- maximum # partitions + 0, -- maximum # regions + 0, -- maximum # dp memory areas + 0, -- maximum # periods + 0, -- maximum # user extensions + RTEMS.MILLISECONDS_TO_MICROSECONDS(10), -- # us in a tick + 50 -- # ticks in a timeslice + ); + +end MPTEST; diff --git a/c/src/ada-tests/mptests/mp11/node1/mptest-per_node_configuration.adb b/c/src/ada-tests/mptests/mp11/node1/mptest-per_node_configuration.adb new file mode 100644 index 0000000000..6d74d74e33 --- /dev/null +++ b/c/src/ada-tests/mptests/mp11/node1/mptest-per_node_configuration.adb @@ -0,0 +1,43 @@ +-- +-- MPTEST.PER_NODE_CONFIGURATION / BODY +-- +-- DESCRIPTION: +-- +-- This package is the specification for the subpackage +-- which will define the per node configuration parameters. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest-per_node_configuration.adb,v 1.2 1995/05/31 16:35:03 joel Exp +-- + +with RTEMS; + +separate ( MPTEST ) + +package body PER_NODE_CONFIGURATION is + +--PAGE +-- +-- LOCAL_NODE_NUMBER +-- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32 is + begin + + return 1; + + end LOCAL_NODE_NUMBER; + +end PER_NODE_CONFIGURATION; diff --git a/c/src/ada-tests/mptests/mp11/node2/mptest-per_node_configuration.adb b/c/src/ada-tests/mptests/mp11/node2/mptest-per_node_configuration.adb new file mode 100644 index 0000000000..dd8375a8bd --- /dev/null +++ b/c/src/ada-tests/mptests/mp11/node2/mptest-per_node_configuration.adb @@ -0,0 +1,43 @@ +-- +-- MPTEST.PER_NODE_CONFIGURATION / BODY +-- +-- DESCRIPTION: +-- +-- This package is the specification for the subpackage +-- which will define the per node configuration parameters. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest-per_node_configuration.adb,v 1.2 1995/05/31 16:35:15 joel Exp +-- + +with RTEMS; + +separate ( MPTEST ) + +package body PER_NODE_CONFIGURATION is + +--PAGE +-- +-- LOCAL_NODE_NUMBER +-- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32 is + begin + + return 2; + + end LOCAL_NODE_NUMBER; + +end PER_NODE_CONFIGURATION; diff --git a/c/src/ada-tests/mptests/mp12/mptest.adb b/c/src/ada-tests/mptests/mp12/mptest.adb new file mode 100644 index 0000000000..ff0e1f2c71 --- /dev/null +++ b/c/src/ada-tests/mptests/mp12/mptest.adb @@ -0,0 +1,152 @@ +-- +-- MPTEST / BODY +-- +-- DESCRIPTION: +-- +-- This package is the implementation for Test 12 of the RTEMS +-- Multiprocessor Test Suite. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest.adb,v 1.2 1995/05/31 16:35:25 joel Exp +-- + +with INTERFACES; use INTERFACES; +with RTEMS; +with TEST_SUPPORT; +with TEXT_IO; +with UNSIGNED32_IO; + +package body MPTEST is + + package body PER_NODE_CONFIGURATION is separate; + +--PAGE +-- +-- INIT +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ) is + BUFFER_ADDRESS : RTEMS.ADDRESS; + STATUS : RTEMS.STATUS_CODES; + begin + + TEXT_IO.NEW_LINE( 2 ); + TEXT_IO.PUT( "*** TEST 12 -- NODE " ); + UNSIGNED32_IO.PUT( + MPTEST.MULTIPROCESSING_CONFIGURATION.NODE, + WIDTH => 1 + ); + TEXT_IO.PUT_LINE( " ***" ); + + MPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( '1', '1', '1', ' ' ); + MPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( '2', '2', '2', ' ' ); + + MPTEST.PARTITION_NAME( 1 ) := RTEMS.BUILD_NAME( 'P', 'A', 'R', ' ' ); + + TEXT_IO.PUT_LINE( "Got to the initialization task" ); + + if MPTEST.MULTIPROCESSING_CONFIGURATION.NODE = 2 then + + RTEMS.TASK_WAKE_AFTER( 1 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + TEXT_IO.PUT_LINE( "Getting ID of remote Partition (Global)" ); + + loop + + RTEMS.PARTITION_IDENT( + MPTEST.PARTITION_NAME( 1 ), + RTEMS.SEARCH_ALL_NODES, + MPTEST.PARTITION_ID( 1 ), + STATUS + ); + + exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS ); + + end loop; + + TEXT_IO.PUT_LINE( + "Attempting to delete remote Partition (Global)" + ); + + RTEMS.PARTITION_DELETE( MPTEST.PARTITION_ID( 1 ), STATUS ); + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.ILLEGAL_ON_REMOTE_OBJECT, + "PARTITION_DELETE" + ); + + TEXT_IO.PUT_LINE( + "partition_delete correctly returned ILLEGAL_ON_REMOTE_OBJECT!!" + ); + + TEXT_IO.PUT_LINE( "Obtaining a buffer from the global partition" ); + + RTEMS.PARTITION_GET_BUFFER( + MPTEST.PARTITION_ID( 1 ), + BUFFER_ADDRESS, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_GET_BUFFER" ); + TEXT_IO.PUT( "Address returned was : " ); + UNSIGNED32_IO.PUT( + RTEMS.SUBTRACT( BUFFER_ADDRESS, RTEMS.NULL_ADDRESS ), + WIDTH => 8, + BASE => 16 + ); + TEXT_IO.NEW_LINE; + + RTEMS.PARTITION_RETURN_BUFFER( + MPTEST.PARTITION_ID( 1 ), + BUFFER_ADDRESS, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_RETURN_BUFFER" ); + + RTEMS.TASK_WAKE_AFTER( 2 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + else + + TEXT_IO.PUT_LINE( "Creating Partition (Global)" ); + RTEMS.PARTITION_CREATE( + MPTEST.PARTITION_NAME( 1 ), + MPTEST.PARTITION_AREA( 0 )'ADDRESS, + 128, + 64, + RTEMS.GLOBAL, + MPTEST.PARTITION_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_CREATE" ); + + TEXT_IO.PUT_LINE( "Sleeping for three seconds" ); + RTEMS.TASK_WAKE_AFTER( 3 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + TEXT_IO.PUT_LINE( "Deleting Partition (Global)" ); + RTEMS.PARTITION_DELETE( MPTEST.PARTITION_ID( 1 ), STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_DELETE" ); + + end if; + + TEXT_IO.PUT_LINE( "*** END OF TEST 12 ***" ); + + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end INIT; + +end MPTEST; diff --git a/c/src/ada-tests/mptests/mp12/mptest.ads b/c/src/ada-tests/mptests/mp12/mptest.ads new file mode 100644 index 0000000000..fc1914c0b2 --- /dev/null +++ b/c/src/ada-tests/mptests/mp12/mptest.ads @@ -0,0 +1,183 @@ +-- +-- MPTEST / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package is the specification for Test 12 of the RTEMS +-- Multiprocessor Test Suite. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest.ads,v 1.3 1995/07/12 19:40:11 joel Exp +-- + +with CLOCK_DRIVER; +with BSP_MPCI; +with RTEMS; + +package MPTEST is + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS tasks created +-- by this test. +-- + + TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.ID; + TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.NAME; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS semaphore +-- created by this test. +-- + + PARTITION_ID : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.ID; + PARTITION_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.NAME; + +-- +-- This variable contains the ID of the remote task with which this +-- test interacts. +-- + + REMOTE_TID : RTEMS.ID; + +-- +-- This variable contains the node on which the remote task with which +-- this test interacts resides. +-- + + REMOTE_NODE : RTEMS.UNSIGNED32; + +-- +-- INIT +-- +-- DESCRIPTION: +-- +-- This RTEMS task initializes the application. +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ); + +-- +-- This is the area used for the partition. +-- + + PARTITION_AREA : + array ( RTEMS.UNSIGNED32 range 0 .. 1023 ) of RTEMS.UNSIGNED8; + for PARTITION_AREA'ALIGNMENT use RTEMS.STRUCTURE_ALIGNMENT; + +-- +-- This is the Driver Address Table for this test. +-- + + DEVICE_DRIVERS : aliased RTEMS.DRIVER_ADDRESS_TABLE( 1 .. 1 ) := + (1=> + ( + CLOCK_DRIVER.INITIALIZE'ACCESS, -- Initialization + RTEMS.NO_DRIVER_ENTRY, -- Open + RTEMS.NO_DRIVER_ENTRY, -- Close + RTEMS.NO_DRIVER_ENTRY, -- Read + RTEMS.NO_DRIVER_ENTRY, -- Write + RTEMS.NO_DRIVER_ENTRY -- Control + ) + ); + +-- +-- This is the Initialization Tasks Table for this test. +-- + + INITIALIZATION_TASKS : aliased RTEMS.INITIALIZATION_TASKS_TABLE( 1 .. 1 ) := + (1=> + ( + RTEMS.BUILD_NAME( 'U', 'I', '1', ' ' ), -- task name + 2048, -- stack size + 1, -- priority + RTEMS.DEFAULT_ATTRIBUTES, -- attributes + MPTEST.INIT'ACCESS, -- entry point + RTEMS.NO_PREEMPT, -- initial mode + 0 -- argument list + ) + ); + +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- +-- BEGIN SUBPACKAGE -- +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- + + -- + -- MPTEST.PER_NODE_CONFIGURATION / SPECIFICATION + -- + -- DESCRIPTION: + -- + -- This package is the specification for the subpackage + -- which will define the per node configuration parameters. + -- + + package PER_NODE_CONFIGURATION is + + -- + -- LOCAL_NODE_NUMBER + -- + -- DESCRIPTION: + -- + -- This function returns the node number for this node. + -- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32; + + pragma INLINE ( LOCAL_NODE_NUMBER ); + + end PER_NODE_CONFIGURATION; + +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- +-- END SUBPACKAGE -- +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- + +-- +-- This is the Multiprocessor Configuration Table for this test. +-- + + MULTIPROCESSING_CONFIGURATION : aliased RTEMS.MULTIPROCESSING_TABLE := ( + MPTEST.PER_NODE_CONFIGURATION.LOCAL_NODE_NUMBER, + 2, -- maximum # nodes in system + 32, -- maximum # global objects + 32 -- maximum # proxies + ); + +-- +-- This is the Configuration Table for this test. +-- + + CONFIGURATION : aliased RTEMS.CONFIGURATION_TABLE := ( + RTEMS.NULL_ADDRESS, -- will be replaced by BSP + 64 * 1024, -- executive RAM size + 10, -- maximum # tasks + 0, -- maximum # timers + 0, -- maximum # semaphores + 0, -- maximum # message queues + 0, -- maximum # messages + 1, -- maximum # partitions + 0, -- maximum # regions + 0, -- maximum # dp memory areas + 0, -- maximum # periods + 0, -- maximum # user extensions + RTEMS.MILLISECONDS_TO_MICROSECONDS(10), -- # us in a tick + 50 -- # ticks in a timeslice + ); + +end MPTEST; diff --git a/c/src/ada-tests/mptests/mp12/node1/mptest-per_node_configuration.adb b/c/src/ada-tests/mptests/mp12/node1/mptest-per_node_configuration.adb new file mode 100644 index 0000000000..59c4906316 --- /dev/null +++ b/c/src/ada-tests/mptests/mp12/node1/mptest-per_node_configuration.adb @@ -0,0 +1,43 @@ +-- +-- MPTEST.PER_NODE_CONFIGURATION / BODY +-- +-- DESCRIPTION: +-- +-- This package is the specification for the subpackage +-- which will define the per node configuration parameters. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest-per_node_configuration.adb,v 1.2 1995/05/31 16:35:19 joel Exp +-- + +with RTEMS; + +separate ( MPTEST ) + +package body PER_NODE_CONFIGURATION is + +--PAGE +-- +-- LOCAL_NODE_NUMBER +-- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32 is + begin + + return 1; + + end LOCAL_NODE_NUMBER; + +end PER_NODE_CONFIGURATION; diff --git a/c/src/ada-tests/mptests/mp12/node2/mptest-per_node_configuration.adb b/c/src/ada-tests/mptests/mp12/node2/mptest-per_node_configuration.adb new file mode 100644 index 0000000000..d96f0cea14 --- /dev/null +++ b/c/src/ada-tests/mptests/mp12/node2/mptest-per_node_configuration.adb @@ -0,0 +1,43 @@ +-- +-- MPTEST.PER_NODE_CONFIGURATION / BODY +-- +-- DESCRIPTION: +-- +-- This package is the specification for the subpackage +-- which will define the per node configuration parameters. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest-per_node_configuration.adb,v 1.2 1995/05/31 16:35:30 joel Exp +-- + +with RTEMS; + +separate ( MPTEST ) + +package body PER_NODE_CONFIGURATION is + +--PAGE +-- +-- LOCAL_NODE_NUMBER +-- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32 is + begin + + return 2; + + end LOCAL_NODE_NUMBER; + +end PER_NODE_CONFIGURATION; diff --git a/c/src/ada-tests/mptests/mp13/mptest.adb b/c/src/ada-tests/mptests/mp13/mptest.adb new file mode 100644 index 0000000000..08ce8f2cbb --- /dev/null +++ b/c/src/ada-tests/mptests/mp13/mptest.adb @@ -0,0 +1,328 @@ +-- +-- MPTEST / BODY +-- +-- DESCRIPTION: +-- +-- This package is the implementation for Test 13 of the RTEMS +-- Multiprocessor Test Suite. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest.adb,v 1.3 1995/07/12 19:40:19 joel Exp +-- + +with INTERFACES; use INTERFACES; +with RTEMS; +with TEST_SUPPORT; +with TEXT_IO; +with UNSIGNED32_IO; + +package body MPTEST is + + package body PER_NODE_CONFIGURATION is separate; + +--PAGE +-- +-- INIT +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ) is + STATUS : RTEMS.STATUS_CODES; + begin + + TEXT_IO.NEW_LINE( 2 ); + TEXT_IO.PUT( "*** TEST 13 -- NODE " ); + UNSIGNED32_IO.PUT( + MPTEST.MULTIPROCESSING_CONFIGURATION.NODE, + WIDTH => 1 + ); + TEXT_IO.PUT_LINE( " ***" ); + + MPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( '1', '1', '1', ' ' ); + MPTEST.TASK_NAME( 2 ) := RTEMS.BUILD_NAME( '2', '2', '2', ' ' ); + + MPTEST.QUEUE_NAME( 1 ) := RTEMS.BUILD_NAME( 'M', 'S', 'G', ' ' ); + + MPTEST.SEMAPHORE_NAME( 1 ) := RTEMS.BUILD_NAME( 'S', 'E', 'M', ' ' ); + + if MPTEST.MULTIPROCESSING_CONFIGURATION.NODE = 1 then + + TEXT_IO.PUT_LINE( "Creating Message Queue (Global)" ); + RTEMS.MESSAGE_QUEUE_CREATE( + MPTEST.QUEUE_NAME( 1 ), + 3, + RTEMS.GLOBAL + RTEMS.LIMIT, + MPTEST.QUEUE_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_CREATE" ); + + TEXT_IO.PUT_LINE( "Creating Semaphore (Global)" ); + RTEMS.SEMAPHORE_CREATE( + MPTEST.SEMAPHORE_NAME( 1 ), + 1, + RTEMS.GLOBAL + RTEMS.PRIORITY, + MPTEST.SEMAPHORE_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_CREATE" ); + + RTEMS.SEMAPHORE_OBTAIN( + MPTEST.SEMAPHORE_ID( 1 ), + RTEMS.DEFAULT_OPTIONS, + RTEMS.NO_TIMEOUT, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_OBTAIN" ); + + end if; + + TEXT_IO.PUT_LINE( "Creating Test_task 1 (local)" ); + RTEMS.TASK_CREATE( + MPTEST.TASK_NAME( 1 ), + 1, + 2048, + RTEMS.TIMESLICE, + RTEMS.DEFAULT_ATTRIBUTES, + MPTEST.TASK_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" ); + + TEXT_IO.PUT_LINE( "Starting Test_task 1 (local)" ); + RTEMS.TASK_START( + MPTEST.TASK_ID( 1 ), + MPTEST.TEST_TASK_1'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" ); + + TEXT_IO.PUT_LINE( "Creating Test_task 2 (local)" ); + RTEMS.TASK_CREATE( + MPTEST.TASK_NAME( 2 ), + 1, + 2048, + RTEMS.TIMESLICE, + RTEMS.DEFAULT_ATTRIBUTES, + MPTEST.TASK_ID( 2 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" ); + + TEXT_IO.PUT_LINE( "Starting Test_task 2 (local)" ); + RTEMS.TASK_START( + MPTEST.TASK_ID( 2 ), + MPTEST.TEST_TASK_2'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" ); + + if MPTEST.MULTIPROCESSING_CONFIGURATION.NODE = 1 then + + RTEMS.TASK_WAKE_AFTER( 5 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + TEXT_IO.PUT_LINE( "*** END OF TEST 13 ***" ); + + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end if; + + TEXT_IO.PUT_LINE( "Deleting initialization task" ); + RTEMS.TASK_DELETE( RTEMS.SELF, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" ); + + end INIT; + +--PAGE +-- +-- TEST_TASK_1 +-- + + procedure TEST_TASK_1 ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ) is + COUNT : RTEMS.UNSIGNED32; + RECEIVE_BUFFER_AREA : RTEMS.BUFFER; + RECEIVE_BUFFER : RTEMS.BUFFER_POINTER; + STATUS : RTEMS.STATUS_CODES; + begin + + RECEIVE_BUFFER := + RTEMS.TO_BUFFER_POINTER( RECEIVE_BUFFER_AREA'ADDRESS ); + + TEXT_IO.PUT_LINE( "Getting QID of message queue" ); + + loop + + RTEMS.MESSAGE_QUEUE_IDENT( + MPTEST.QUEUE_NAME( 1 ), + RTEMS.SEARCH_ALL_NODES, + MPTEST.QUEUE_ID( 1 ), + STATUS + ); + + exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS ); + + end loop; + + if MPTEST.MULTIPROCESSING_CONFIGURATION.NODE = 1 then + + TEXT_IO.PUT_LINE( "Receiving message ..." ); + RTEMS.MESSAGE_QUEUE_RECEIVE( + MPTEST.QUEUE_ID( 1 ), + RECEIVE_BUFFER, + RTEMS.DEFAULT_OPTIONS, + RTEMS.NO_TIMEOUT, + STATUS + ); + TEXT_IO.PUT_LINE( "How did I get back from here???" ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_RECEIVE" ); + + end if; + + RTEMS.TASK_WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + TEXT_IO.PUT_LINE( "Receiving message ..." ); + RTEMS.MESSAGE_QUEUE_RECEIVE( + MPTEST.QUEUE_ID( 1 ), + RECEIVE_BUFFER, + RTEMS.DEFAULT_OPTIONS, + 2 * TEST_SUPPORT.TICKS_PER_SECOND, + STATUS + ); + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.TIMEOUT, + "MESSAGE_QUEUE_RECEIVE" + ); + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.TIMEOUT, + "MESSAGE_QUEUE_OBTAIN" + ); + + TEXT_IO.PUT_LINE( + "message_queue_receive correctly returned TIMEOUT" + ); + + TEXT_IO.PUT_LINE( "Deleting self" ); + RTEMS.TASK_DELETE( RTEMS.SELF, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" ); + + end TEST_TASK_1; + +--PAGE +-- +-- TEST_TASK_2 +-- + + procedure TEST_TASK_2 ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ) is + STATUS : RTEMS.STATUS_CODES; + begin + + TEXT_IO.PUT_LINE( "Getting SMID of semaphore" ); + + loop + + RTEMS.SEMAPHORE_IDENT( + MPTEST.SEMAPHORE_NAME( 1 ), + RTEMS.SEARCH_ALL_NODES, + MPTEST.SEMAPHORE_ID( 1 ), + STATUS + ); + + exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS ); + + end loop; + + if MPTEST.MULTIPROCESSING_CONFIGURATION.NODE = 1 then + + RTEMS.TASK_WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + TEXT_IO.PUT_LINE( "Releasing semaphore ..." ); + RTEMS.SEMAPHORE_RELEASE( MPTEST.SEMAPHORE_ID( 1 ), STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_RELEASE" ); + + RTEMS.TASK_WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND / 2, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + TEXT_IO.PUT_LINE( "Getting semaphore ..." ); + RTEMS.SEMAPHORE_OBTAIN( + MPTEST.SEMAPHORE_ID( 1 ), + RTEMS.DEFAULT_OPTIONS, + RTEMS.NO_TIMEOUT, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_OBTAIN" ); + + TEXT_IO.PUT_LINE( "Getting semaphore ..." ); + RTEMS.SEMAPHORE_OBTAIN( + MPTEST.SEMAPHORE_ID( 1 ), + RTEMS.DEFAULT_OPTIONS, + RTEMS.NO_TIMEOUT, + STATUS + ); + TEXT_IO.PUT_LINE( "How did I get back from here???" ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_OBTAIN" ); + + end if; + + RTEMS.TASK_WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND / 2, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + TEXT_IO.PUT_LINE( "Getting semaphore ..." ); + RTEMS.SEMAPHORE_OBTAIN( + MPTEST.SEMAPHORE_ID( 1 ), + RTEMS.DEFAULT_OPTIONS, + RTEMS.NO_TIMEOUT, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_OBTAIN" ); + + TEXT_IO.PUT_LINE( "Releasing semaphore ..." ); + RTEMS.SEMAPHORE_RELEASE( MPTEST.SEMAPHORE_ID( 1 ), STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_RELEASE" ); + + RTEMS.TASK_WAKE_AFTER( TEST_SUPPORT.TICKS_PER_SECOND, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + + TEXT_IO.PUT_LINE( "Getting semaphore ..." ); + RTEMS.SEMAPHORE_OBTAIN( + MPTEST.SEMAPHORE_ID( 1 ), + RTEMS.DEFAULT_OPTIONS, + 2 * TEST_SUPPORT.TICKS_PER_SECOND, + STATUS + ); + TEST_SUPPORT.FATAL_DIRECTIVE_STATUS( + STATUS, + RTEMS.TIMEOUT, + "SEMAPHORE_OBTAIN" + ); + TEXT_IO.PUT_LINE( "semaphore_obtain correctly returned TIMEOUT" ); + + TEXT_IO.PUT_LINE( "*** END OF TEST 13 ***" ); + + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end TEST_TASK_2; + +end MPTEST; diff --git a/c/src/ada-tests/mptests/mp13/mptest.ads b/c/src/ada-tests/mptests/mp13/mptest.ads new file mode 100644 index 0000000000..449980dd39 --- /dev/null +++ b/c/src/ada-tests/mptests/mp13/mptest.ads @@ -0,0 +1,207 @@ +-- +-- MPTEST / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package is the specification for Test 13 of the RTEMS +-- Multiprocessor Test Suite. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest.ads,v 1.3 1995/07/12 19:40:20 joel Exp +-- + +with CLOCK_DRIVER; +with BSP_MPCI; +with RTEMS; + +package MPTEST is + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS tasks created +-- by this test. +-- + + TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.ID; + TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 3 ) of RTEMS.NAME; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS message +-- queues created by this test. +-- + + QUEUE_ID : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.ID; + QUEUE_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.NAME; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS semaphore +-- created by this test. +-- + + SEMAPHORE_ID : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.ID; + SEMAPHORE_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 2 ) of RTEMS.NAME; + +-- +-- This variable contains the ID of the remote task with which this +-- test interacts. +-- + + REMOTE_TID : RTEMS.ID; + +-- +-- This variable contains the node on which the remote task with which +-- this test interacts resides. +-- + + REMOTE_NODE : RTEMS.UNSIGNED32; + +-- +-- INIT +-- +-- DESCRIPTION: +-- +-- This RTEMS task initializes the application. +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ); + +-- +-- TEST_TASK_1 +-- +-- DESCRIPTION: +-- +-- This is the body of one of the RTEMS tasks which constitute this test. +-- + + procedure TEST_TASK_1 ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ); + +-- +-- TEST_TASK_2 +-- +-- DESCRIPTION: +-- +-- This is the body of one of the RTEMS tasks which constitute this test. +-- + + procedure TEST_TASK_2 ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ); + +-- +-- This is the Driver Address Table for this test. +-- + + DEVICE_DRIVERS : aliased RTEMS.DRIVER_ADDRESS_TABLE( 1 .. 1 ) := + (1=> + ( + CLOCK_DRIVER.INITIALIZE'ACCESS, -- Initialization + RTEMS.NO_DRIVER_ENTRY, -- Open + RTEMS.NO_DRIVER_ENTRY, -- Close + RTEMS.NO_DRIVER_ENTRY, -- Read + RTEMS.NO_DRIVER_ENTRY, -- Write + RTEMS.NO_DRIVER_ENTRY -- Control + ) + ); + +-- +-- This is the Initialization Tasks Table for this test. +-- + + INITIALIZATION_TASKS : aliased RTEMS.INITIALIZATION_TASKS_TABLE( 1 .. 1 ) := + (1=> + ( + RTEMS.BUILD_NAME( 'U', 'I', '1', ' ' ), -- task name + 2048, -- stack size + 1, -- priority + RTEMS.DEFAULT_ATTRIBUTES, -- attributes + MPTEST.INIT'ACCESS, -- entry point + RTEMS.NO_PREEMPT, -- initial mode + 0 -- argument list + ) + ); + +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- +-- BEGIN SUBPACKAGE -- +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- + + -- + -- MPTEST.PER_NODE_CONFIGURATION / SPECIFICATION + -- + -- DESCRIPTION: + -- + -- This package is the specification for the subpackage + -- which will define the per node configuration parameters. + -- + + package PER_NODE_CONFIGURATION is + + -- + -- LOCAL_NODE_NUMBER + -- + -- DESCRIPTION: + -- + -- This function returns the node number for this node. + -- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32; + + pragma INLINE ( LOCAL_NODE_NUMBER ); + + end PER_NODE_CONFIGURATION; + +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- +-- END SUBPACKAGE -- +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- + +-- +-- This is the Multiprocessor Configuration Table for this test. +-- + + MULTIPROCESSING_CONFIGURATION : aliased RTEMS.MULTIPROCESSING_TABLE := ( + MPTEST.PER_NODE_CONFIGURATION.LOCAL_NODE_NUMBER, + 2, -- maximum # nodes in system + 32, -- maximum # global objects + 32 -- maximum # proxies + ); + +-- +-- This is the Configuration Table for this test. +-- + + CONFIGURATION : aliased RTEMS.CONFIGURATION_TABLE := ( + RTEMS.NULL_ADDRESS, -- will be replaced by BSP + 64 * 1024, -- executive RAM size + 10, -- maximum # tasks + 0, -- maximum # timers + 1, -- maximum # semaphores + 1, -- maximum # message queues + 0, -- maximum # messages + 0, -- maximum # partitions + 0, -- maximum # regions + 0, -- maximum # dp memory areas + 0, -- maximum # periods + 0, -- maximum # user extensions + RTEMS.MILLISECONDS_TO_MICROSECONDS(10), -- # us in a tick + 50 -- # ticks in a timeslice + ); + +end MPTEST; diff --git a/c/src/ada-tests/mptests/mp13/node1/mptest-per_node_configuration.adb b/c/src/ada-tests/mptests/mp13/node1/mptest-per_node_configuration.adb new file mode 100644 index 0000000000..89dee477ed --- /dev/null +++ b/c/src/ada-tests/mptests/mp13/node1/mptest-per_node_configuration.adb @@ -0,0 +1,43 @@ +-- +-- MPTEST.PER_NODE_CONFIGURATION / BODY +-- +-- DESCRIPTION: +-- +-- This package is the specification for the subpackage +-- which will define the per node configuration parameters. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest-per_node_configuration.adb,v 1.2 1995/05/31 16:35:34 joel Exp +-- + +with RTEMS; + +separate ( MPTEST ) + +package body PER_NODE_CONFIGURATION is + +--PAGE +-- +-- LOCAL_NODE_NUMBER +-- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32 is + begin + + return 1; + + end LOCAL_NODE_NUMBER; + +end PER_NODE_CONFIGURATION; diff --git a/c/src/ada-tests/mptests/mp13/node2/mptest-per_node_configuration.adb b/c/src/ada-tests/mptests/mp13/node2/mptest-per_node_configuration.adb new file mode 100644 index 0000000000..a1bf6f6205 --- /dev/null +++ b/c/src/ada-tests/mptests/mp13/node2/mptest-per_node_configuration.adb @@ -0,0 +1,43 @@ +-- +-- MPTEST.PER_NODE_CONFIGURATION / BODY +-- +-- DESCRIPTION: +-- +-- This package is the specification for the subpackage +-- which will define the per node configuration parameters. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest-per_node_configuration.adb,v 1.2 1995/05/31 16:35:45 joel Exp +-- + +with RTEMS; + +separate ( MPTEST ) + +package body PER_NODE_CONFIGURATION is + +--PAGE +-- +-- LOCAL_NODE_NUMBER +-- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32 is + begin + + return 2; + + end LOCAL_NODE_NUMBER; + +end PER_NODE_CONFIGURATION; diff --git a/c/src/ada-tests/mptests/mp14/mptest.adb b/c/src/ada-tests/mptests/mp14/mptest.adb new file mode 100644 index 0000000000..35ffe161f5 --- /dev/null +++ b/c/src/ada-tests/mptests/mp14/mptest.adb @@ -0,0 +1,764 @@ +-- +-- MPTEST / BODY +-- +-- DESCRIPTION: +-- +-- This package is the implementation for Test 14 of the RTEMS +-- Multiprocessor Test Suite. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest.adb,v 1.3 1995/07/12 19:40:27 joel Exp +-- + +with INTERFACES; use INTERFACES; +with BSP; +with BSP_MPCI; +with RTEMS; +with TEST_SUPPORT; +with TEXT_IO; +with UNSIGNED32_IO; + +package body MPTEST is + + package body PER_NODE_CONFIGURATION is separate; + +--PAGE +-- +-- STOP_TEST_TSR +-- + + procedure STOP_TEST_TSR ( + IGNORED_ID : in RTEMS.ID; + IGNORED_ADDRESS : in RTEMS.ADDRESS + ) is + begin + + MPTEST.STOP_TEST := TRUE; + + end STOP_TEST_TSR; + +--PAGE +-- +-- EXIT_TEST +-- + + procedure EXIT_TEST is + OLD_MODE : RTEMS.MODE; + STATUS : RTEMS.STATUS_CODES; + begin + + RTEMS.TASK_MODE( RTEMS.NO_PREEMPT, RTEMS.PREEMPT_MASK, OLD_MODE, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_MODE" ); + + BSP_MPCI.PRINT_STATISTICS; + + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end EXIT_TEST; + +--PAGE +-- +-- INIT +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ) is + INDEX : RTEMS.UNSIGNED32; + STATUS : RTEMS.STATUS_CODES; + PREVIOUS_PRIORITY : RTEMS.TASK_PRIORITY; + begin + + TEXT_IO.NEW_LINE( 2 ); + TEXT_IO.PUT( "*** TEST 14 -- NODE " ); + UNSIGNED32_IO.PUT( + MPTEST.MULTIPROCESSING_CONFIGURATION.NODE, + WIDTH => 1 + ); + TEXT_IO.PUT_LINE( " ***" ); + + MPTEST.STOP_TIMER_NAME := RTEMS.BUILD_NAME( 'S', 'T', 'O', 'P' ); + + MPTEST.STOP_TEST := FALSE; + + RTEMS.TIMER_CREATE( + MPTEST.STOP_TIMER_NAME, + MPTEST.STOP_TIMER_ID, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_CREATE" ); + + RTEMS.TIMER_FIRE_AFTER( + MPTEST.STOP_TIMER_ID, + BSP.MAXIMUM_LONG_TEST_DURATION * TEST_SUPPORT.TICKS_PER_SECOND, + MPTEST.STOP_TEST_TSR'ACCESS, + RTEMS.NULL_ADDRESS, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_AFTER" ); + + MPTEST.EVENT_TASK_NAME( 1 ) := RTEMS.BUILD_NAME( '1', '1', '1', ' ' ); + MPTEST.EVENT_TASK_NAME( 2 ) := RTEMS.BUILD_NAME( '2', '2', '2', ' ' ); + + MPTEST.QUEUE_TASK_NAME( 1 ) := RTEMS.BUILD_NAME( 'M', 'T', '1', ' ' ); + MPTEST.QUEUE_TASK_NAME( 2 ) := RTEMS.BUILD_NAME( 'M', 'T', '2', ' ' ); + + MPTEST.PARTITION_TASK_NAME( 1 ) := + RTEMS.BUILD_NAME( 'P', 'T', '1', ' ' ); + MPTEST.PARTITION_TASK_NAME( 2 ) := + RTEMS.BUILD_NAME( 'P', 'T', '2', ' ' ); + + MPTEST.SEMAPHORE_TASK_NAME( 1 ) := + RTEMS.BUILD_NAME( 'S', 'M', '1', ' ' ); + MPTEST.SEMAPHORE_TASK_NAME( 2 ) := + RTEMS.BUILD_NAME( 'S', 'M', '2', ' ' ); + + MPTEST.SEMAPHORE_NAME( 1 ) := RTEMS.BUILD_NAME( 'S', 'E', 'M', ' ' ); + + MPTEST.QUEUE_NAME( 1 ) := RTEMS.BUILD_NAME( 'M', 'S', 'G', ' ' ); + + MPTEST.PARTITION_NAME( 1 ) := RTEMS.BUILD_NAME( 'P', 'A', 'R', ' ' ); + + MPTEST.TIMER_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'M', 'R', ' ' ); + + for INDEX in MPTEST.BUFFERS'FIRST .. MPTEST.BUFFERS'LAST + loop + + MPTEST.BUFFERS( INDEX ) := + RTEMS.TO_BUFFER_POINTER( MPTEST.BUFFER_AREAS( INDEX )'ADDRESS ); + + end loop; + + if MPTEST.MULTIPROCESSING_CONFIGURATION.NODE = 1 then + + TEXT_IO.PUT_LINE( "Creating Semaphore (Global)" ); + RTEMS.SEMAPHORE_CREATE( + MPTEST.SEMAPHORE_NAME( 1 ), + 1, + RTEMS.GLOBAL, + MPTEST.SEMAPHORE_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_CREATE" ); + + TEXT_IO.PUT_LINE( "Creating Message Queue (Global)" ); + RTEMS.MESSAGE_QUEUE_CREATE( + MPTEST.QUEUE_NAME( 1 ), + 1, + RTEMS.GLOBAL, + MPTEST.QUEUE_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_CREATE" ); + + TEXT_IO.PUT_LINE( "Creating Partition (Global)" ); + RTEMS.PARTITION_CREATE( + MPTEST.PARTITION_NAME( 1 ), + MPTEST.PARTITION_AREA( 0 )'ADDRESS, + 16#8000#, + 16#3000#, + RTEMS.GLOBAL, + MPTEST.PARTITION_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_CREATE" ); + + end if; + + TEXT_IO.PUT_LINE( "Creating Event task (Global)" ); + RTEMS.TASK_CREATE( + MPTEST.EVENT_TASK_NAME( + MPTEST.MULTIPROCESSING_CONFIGURATION.NODE + ), + 2, + 2048, + RTEMS.TIMESLICE, + RTEMS.GLOBAL, + MPTEST.EVENT_TASK_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" ); + + TEXT_IO.PUT_LINE( "Starting Event task (Global)" ); + RTEMS.TASK_START( + MPTEST.EVENT_TASK_ID( 1 ), + MPTEST.TEST_TASK'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" ); + + TEXT_IO.PUT_LINE( "Creating Semaphore task (Global)" ); + RTEMS.TASK_CREATE( + MPTEST.SEMAPHORE_TASK_NAME( + MPTEST.MULTIPROCESSING_CONFIGURATION.NODE + ), + 2, + 2048, + RTEMS.TIMESLICE, + RTEMS.GLOBAL, + MPTEST.SEMAPHORE_TASK_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" ); + + TEXT_IO.PUT_LINE( "Starting Semaphore task (Global)" ); + RTEMS.TASK_START( + MPTEST.SEMAPHORE_TASK_ID( 1 ), + MPTEST.SEMAPHORE_TASK'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" ); + + TEXT_IO.PUT_LINE( "Creating Message Queue task (Global)" ); + RTEMS.TASK_CREATE( + MPTEST.QUEUE_TASK_NAME( + MPTEST.MULTIPROCESSING_CONFIGURATION.NODE + ), + 2, + 2048, + RTEMS.TIMESLICE, + RTEMS.GLOBAL, + MPTEST.QUEUE_TASK_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" ); + + TEXT_IO.PUT_LINE( "Starting Message Queue task (Global)" ); + RTEMS.TASK_START( + MPTEST.QUEUE_TASK_ID( 1 ), + MPTEST.MESSAGE_QUEUE_TASK'ACCESS, + 1, -- index of buffer + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" ); + + TEXT_IO.PUT_LINE( "Creating Partition task (Global)" ); + RTEMS.TASK_CREATE( + MPTEST.PARTITION_TASK_NAME( + MPTEST.MULTIPROCESSING_CONFIGURATION.NODE + ), + 2, + 2048, + RTEMS.TIMESLICE, + RTEMS.GLOBAL, + MPTEST.PARTITION_TASK_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE" ); + + TEXT_IO.PUT_LINE( "Starting Partition task (Global)" ); + RTEMS.TASK_START( + MPTEST.PARTITION_TASK_ID( 1 ), + MPTEST.PARTITION_TASK'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START" ); + + RTEMS.TASK_SET_PRIORITY( RTEMS.SELF, 2, PREVIOUS_PRIORITY, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_SET_PRIORITY" ); + + MPTEST.DELAYED_EVENTS_TASK( 1 ); + + end INIT; + +-- +-- DELAYED_SEND_EVENT +-- +-- DESCRIPTION: +-- +-- This subprogram is a timer service routine which sends an +-- event set to a waiting task. +-- + + procedure DELAYED_SEND_EVENT ( + TIMER_ID : in RTEMS.ID; + IGNORED_ADDRESS : in RTEMS.ADDRESS + ) is + STATUS : RTEMS.STATUS_CODES; + begin + + RTEMS.EVENT_SEND( + MPTEST.TASK_ID( RTEMS.GET_INDEX( TIMER_ID ) ), + RTEMS.EVENT_16, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_SEND" ); + + end DELAYED_SEND_EVENT; + +-- +-- TEST_TASK +-- +-- DESCRIPTION: +-- +-- This is one of the test tasks. +-- + + procedure TEST_TASK ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ) is + REMOTE_NODE : RTEMS.UNSIGNED32; + REMOTE_TID : RTEMS.ID; + COUNT : RTEMS.UNSIGNED32; + EVENT_OUT : RTEMS.EVENT_SET; + STATUS : RTEMS.STATUS_CODES; + begin + + if MPTEST.MULTIPROCESSING_CONFIGURATION.NODE = 1 then + REMOTE_NODE := 2; + else + REMOTE_NODE := 1; + end if; + + TEXT_IO.PUT_LINE( "About to go to sleep!" ); + RTEMS.TASK_WAKE_AFTER( 1 * TEST_SUPPORT.TICKS_PER_SECOND, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_WAKE_AFTER" ); + TEXT_IO.PUT_LINE( "Waking up!" ); + + TEXT_IO.PUT( "Remote task's name is : " ); + TEST_SUPPORT.PUT_NAME( MPTEST.EVENT_TASK_NAME( REMOTE_NODE ), TRUE ); + + TEXT_IO.PUT_LINE( "Getting TID of remote task" ); + + loop + + RTEMS.TASK_IDENT( + MPTEST.EVENT_TASK_NAME( REMOTE_NODE ), + RTEMS.SEARCH_ALL_NODES, + REMOTE_TID, + STATUS + ); + + exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS ); + + TEXT_IO.PUT_LINE( "task_ident" ); + + end loop; + + if MPTEST.MULTIPROCESSING_CONFIGURATION.NODE = 1 then + TEXT_IO.PUT_LINE( "Sending events to remote task" ); + + loop + exit when MPTEST.STOP_TEST = TRUE; + + for COUNT in 1 .. MPTEST.EVENT_TASK_DOT_COUNT + loop + RTEMS.EVENT_SEND( + REMOTE_TID, + RTEMS.EVENT_16, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_SEND" ); + + exit when MPTEST.STOP_TEST = TRUE; + + end loop; + + TEST_SUPPORT.PUT_DOT( "e" ); + + end loop; + + end if; + + TEXT_IO.PUT_LINE( "Receiving events from remote task" ); + + loop + exit when MPTEST.STOP_TEST = TRUE; + + for COUNT in 1 .. MPTEST.EVENT_TASK_DOT_COUNT + loop + exit when MPTEST.STOP_TEST = TRUE; + + RTEMS.EVENT_RECEIVE( + RTEMS.EVENT_16, + RTEMS.DEFAULT_OPTIONS, + RTEMS.NO_TIMEOUT, + EVENT_OUT, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_RECEIVE" ); + + end loop; + + TEST_SUPPORT.PUT_DOT( "e" ); + + end loop; + + MPTEST.EXIT_TEST; + + end TEST_TASK; + +-- +-- DELAYED_EVENTS_TASK +-- +-- DESCRIPTION: +-- +-- This is one of the test tasks. +-- + + procedure DELAYED_EVENTS_TASK ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ) is + COUNT : RTEMS.UNSIGNED32; + PREVIOUS_MODE : RTEMS.MODE; + EVENTS_OUT : RTEMS.EVENT_SET; + STATUS : RTEMS.STATUS_CODES; + begin + + RTEMS.TASK_MODE( + RTEMS.PREEMPT + RTEMS.TIMESLICE, + RTEMS.PREEMPT_MASK + RTEMS.TIMESLICE_MASK, + PREVIOUS_MODE, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_MODE" ); + + RTEMS.TIMER_CREATE( + MPTEST.TIMER_NAME( 1 ), + MPTEST.TIMER_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_CREATE" ); + + RTEMS.TASK_IDENT( + RTEMS.SELF, + RTEMS.SEARCH_ALL_NODES, + MPTEST.TASK_ID( RTEMS.GET_INDEX( MPTEST.TIMER_ID( 1 ) ) ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_IDENTS" ); + + loop + + for COUNT in 1 .. MPTEST.DELAYED_EVENT_DOT_COUNT + loop + RTEMS.TIMER_FIRE_AFTER( + MPTEST.TIMER_ID( 1 ), + 1, + MPTEST.DELAYED_SEND_EVENT'ACCESS, + RTEMS.NULL_ADDRESS, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TIMER_FIRE_AFTER" ); + + RTEMS.EVENT_RECEIVE( + RTEMS.EVENT_16, + RTEMS.DEFAULT_OPTIONS, + RTEMS.NO_TIMEOUT, + EVENTS_OUT, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "EVENT_RECEIVE" ); + + end loop; + + TEST_SUPPORT.PUT_DOT( "." ); + + end loop; + + MPTEST.EXIT_TEST; + + end DELAYED_EVENTS_TASK; + +-- +-- MESSAGE_QUEUE_TASK +-- +-- DESCRIPTION: +-- +-- This is one of the test tasks. +-- + + procedure MESSAGE_QUEUE_TASK ( + INDEX : in RTEMS.TASK_ARGUMENT + ) is + COUNT : RTEMS.UNSIGNED32; + YIELD_COUNT : RTEMS.UNSIGNED32; + OVERFLOW_COUNT : RTEMS.UNSIGNED32_POINTER; + BUFFER_COUNT : RTEMS.UNSIGNED32_POINTER; + STATUS : RTEMS.STATUS_CODES; + begin + + MPTEST.BUFFERS( INDEX ).FIELD1 := 0; + MPTEST.BUFFERS( INDEX ).FIELD2 := 0; + MPTEST.BUFFERS( INDEX ).FIELD3 := 0; + MPTEST.BUFFERS( INDEX ).FIELD4 := 0; + + TEXT_IO.PUT_LINE( "Getting ID of message queue" ); + + loop + + RTEMS.MESSAGE_QUEUE_IDENT( + MPTEST.QUEUE_NAME( 1 ), + RTEMS.SEARCH_ALL_NODES, + MPTEST.QUEUE_ID( 1 ), + STATUS + ); + exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS ); + + TEXT_IO.PUT_LINE( "message_queue_ident FAILED!!" ); + + end loop; + + if MPTEST.MULTIPROCESSING_CONFIGURATION.NODE = 1 then + + RTEMS.MESSAGE_QUEUE_SEND( + MPTEST.QUEUE_ID( 1 ), + MPTEST.BUFFERS( INDEX ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_SEND" ); + + OVERFLOW_COUNT := RTEMS.TO_UNSIGNED32_POINTER( + MPTEST.BUFFERS( INDEX ).FIELD1'ADDRESS + ); + + BUFFER_COUNT := RTEMS.TO_UNSIGNED32_POINTER( + MPTEST.BUFFERS( INDEX ).FIELD2'ADDRESS + ); + + else + + OVERFLOW_COUNT := RTEMS.TO_UNSIGNED32_POINTER( + MPTEST.BUFFERS( INDEX ).FIELD3'ADDRESS + ); + + BUFFER_COUNT := RTEMS.TO_UNSIGNED32_POINTER( + MPTEST.BUFFERS( INDEX ).FIELD4'ADDRESS + ); + + end if; + + loop + + exit when MPTEST.STOP_TEST = TRUE; + + YIELD_COUNT := 100; + + for COUNT in 1 .. MPTEST.MESSAGE_DOT_COUNT + loop + + exit when MPTEST.STOP_TEST = TRUE; + + RTEMS.MESSAGE_QUEUE_RECEIVE( + MPTEST.QUEUE_ID( 1 ), + MPTEST.BUFFERS( INDEX ), + RTEMS.DEFAULT_OPTIONS, + RTEMS.NO_TIMEOUT, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( + STATUS, + "MESSAGE_QUEUE_RECEIVE" + ); + + if BUFFER_COUNT.ALL = RTEMS.UNSIGNED32'LAST then + BUFFER_COUNT.ALL := 0; + OVERFLOW_COUNT.ALL := OVERFLOW_COUNT.ALL + 1; + else + BUFFER_COUNT.ALL := BUFFER_COUNT.ALL + 1; + end if; + + RTEMS.MESSAGE_QUEUE_SEND( + MPTEST.QUEUE_ID( 1 ), + MPTEST.BUFFERS( INDEX ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "MESSAGE_QUEUE_SEND" ); + + if MPTEST.STOP_TEST = FALSE then + if MPTEST.MULTIPROCESSING_CONFIGURATION.NODE = 1 then + + YIELD_COUNT := YIELD_COUNT - 1; + + if YIELD_COUNT = 0 then + + RTEMS.TASK_WAKE_AFTER( RTEMS.YIELD_PROCESSOR, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "YIELD" ); + + YIELD_COUNT := 100; + + end if; + + end if; + + end if; + + end loop; + + TEST_SUPPORT.PUT_DOT( "m" ); + + end loop; + + MPTEST.EXIT_TEST; + + end MESSAGE_QUEUE_TASK; + +-- +-- PARTITION_TASK +-- +-- DESCRIPTION: +-- +-- This is one of the test tasks. +-- + + procedure PARTITION_TASK ( + IGNORED : in RTEMS.TASK_ARGUMENT + ) is + COUNT : RTEMS.UNSIGNED32; + BUFFER : RTEMS.ADDRESS; + STATUS : RTEMS.STATUS_CODES; + begin + + TEXT_IO.PUT_LINE( "Getting ID of partition" ); + + loop + + RTEMS.PARTITION_IDENT( + MPTEST.PARTITION_NAME( 1 ), + RTEMS.SEARCH_ALL_NODES, + MPTEST.PARTITION_ID( 1 ), + STATUS + ); + exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS ); + + TEXT_IO.PUT_LINE( "partition_ident FAILED!!" ); + + end loop; + + loop + + exit when MPTEST.STOP_TEST = TRUE; + + for COUNT in 1 .. MPTEST.PARTITION_DOT_COUNT + loop + + exit when MPTEST.STOP_TEST = TRUE; + + RTEMS.PARTITION_GET_BUFFER( + MPTEST.PARTITION_ID( 1 ), + BUFFER, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "PARTITION_GET_BUFFER" ); + + RTEMS.PARTITION_RETURN_BUFFER( + MPTEST.PARTITION_ID( 1 ), + BUFFER, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( + STATUS, + "PARTITION_RETURN_BUFFER" + ); + + if MPTEST.MULTIPROCESSING_CONFIGURATION.NODE = 1 then + + RTEMS.TASK_WAKE_AFTER( RTEMS.YIELD_PROCESSOR, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "YIELD" ); + + end if; + + end loop; + + TEST_SUPPORT.PUT_DOT( "p" ); + + end loop; + + MPTEST.EXIT_TEST; + + end PARTITION_TASK; + +-- +-- SEMAPHORE_TASK +-- +-- DESCRIPTION: +-- +-- This is one of the test tasks. +-- + + procedure SEMAPHORE_TASK ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ) is + COUNT : RTEMS.UNSIGNED32; + YIELD_COUNT : RTEMS.UNSIGNED32; + STATUS : RTEMS.STATUS_CODES; + begin + + TEXT_IO.PUT_LINE( "Getting ID of semaphore" ); + + loop + + RTEMS.SEMAPHORE_IDENT( + MPTEST.SEMAPHORE_NAME( 1 ), + RTEMS.SEARCH_ALL_NODES, + MPTEST.SEMAPHORE_ID( 1 ), + STATUS + ); + exit when RTEMS.IS_STATUS_SUCCESSFUL( STATUS ); + + TEXT_IO.PUT_LINE( "semaphore_ident FAILED!!" ); + + end loop; + + loop + + YIELD_COUNT := 100; + + exit when MPTEST.STOP_TEST = TRUE; + + for COUNT in 1 .. MPTEST.SEMAPHORE_DOT_COUNT + loop + + exit when MPTEST.STOP_TEST = TRUE; + + RTEMS.SEMAPHORE_OBTAIN( + MPTEST.SEMAPHORE_ID( 1 ), + RTEMS.DEFAULT_OPTIONS, + RTEMS.NO_TIMEOUT, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_OBTAIN" ); + + RTEMS.SEMAPHORE_RELEASE( MPTEST.SEMAPHORE_ID( 1 ), STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "SEMAPHORE_RELEASE" ); + + if MPTEST.MULTIPROCESSING_CONFIGURATION.NODE = 1 then + + YIELD_COUNT := YIELD_COUNT - 1; + + if YIELD_COUNT = 0 then + + RTEMS.TASK_WAKE_AFTER( RTEMS.YIELD_PROCESSOR, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "YIELD" ); + + YIELD_COUNT := 100; + + end if; + + end if; + + end loop; + + TEST_SUPPORT.PUT_DOT( "s" ); + + end loop; + + MPTEST.EXIT_TEST; + + end SEMAPHORE_TASK; + +end MPTEST; diff --git a/c/src/ada-tests/mptests/mp14/mptest.ads b/c/src/ada-tests/mptests/mp14/mptest.ads new file mode 100644 index 0000000000..f86db4d21b --- /dev/null +++ b/c/src/ada-tests/mptests/mp14/mptest.ads @@ -0,0 +1,348 @@ +-- +-- MPTEST / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package is the specification for Test 14 of the RTEMS +-- Multiprocessor Test Suite. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest.ads,v 1.3 1995/07/12 19:40:28 joel Exp +-- + +with CLOCK_DRIVER; +with BSP_MPCI; +with RTEMS; + +package MPTEST is + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS tasks created +-- by this test for passing event sets. +-- + + TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.ID; + TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.NAME; +-- +-- These arrays contain the IDs and NAMEs of all RTEMS tasks created +-- by this test for passing event sets. +-- + + EVENT_TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.ID; + EVENT_TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.NAME; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS tasks created +-- by this test for manipulating semaphores. +-- + + SEMAPHORE_TASK_ID : + array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.ID; + SEMAPHORE_TASK_NAME : + array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.NAME; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS tasks created +-- by this test for passing messages. +-- + + QUEUE_TASK_ID : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.ID; + QUEUE_TASK_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.NAME; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS tasks created +-- by this test for manipulating the global partitions. +-- + + PARTITION_TASK_ID : + array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.ID; + PARTITION_TASK_NAME : + array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.NAME; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS partitions +-- created by this test. +-- + + PARTITION_ID : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.ID; + PARTITION_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.NAME; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS semaphores +-- created by this test. +-- + + SEMAPHORE_ID : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.ID; + SEMAPHORE_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.NAME; + +-- +-- These arrays contain the IDs and NAMEs of all RTEMS message_queues +-- created by this test. +-- + + QUEUE_ID : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.ID; + QUEUE_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.NAME; + +-- +-- +-- These arrays contain the IDs and NAMEs of all RTEMS timers +-- created by this test. +-- + + TIMER_ID : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.ID; + TIMER_NAME : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.NAME; + +-- +-- The following are message buffers used to contain the test messages +-- and pointers to those buffers. +-- + + BUFFER_AREAS : array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.BUFFER; + BUFFERS : + array ( RTEMS.UNSIGNED32 range 1 .. 4 ) of RTEMS.BUFFER_POINTER; + +-- +-- This is the area used for the partition. +-- + + PARTITION_AREA : + array ( RTEMS.UNSIGNED32 range 0 .. 16#7FFF# ) of RTEMS.UNSIGNED8; + for PARTITION_AREA'ALIGNMENT use RTEMS.STRUCTURE_ALIGNMENT; + +-- +-- The following constants control the flow of "dot" indicators +-- from the various test componenents. +-- + + EVENT_TASK_DOT_COUNT : constant RTEMS.UNSIGNED32 := 100; + EVENT_SEND_DOT_COUNT : constant RTEMS.UNSIGNED32 := 100; + DELAYED_EVENT_DOT_COUNT : constant RTEMS.UNSIGNED32 := 1000; + MESSAGE_DOT_COUNT : constant RTEMS.UNSIGNED32 := 200; + PARTITION_DOT_COUNT : constant RTEMS.UNSIGNED32 := 200; + SEMAPHORE_DOT_COUNT : constant RTEMS.UNSIGNED32 := 200; + +-- +-- These contain the IDs and NAMEs of the RTEMS timers used +-- by this test to stop. +-- + + STOP_TIMER_ID : RTEMS.ID; + STOP_TIMER_NAME : RTEMS.NAME; + +-- +-- This variable is set when the test should stop executing. +-- + + STOP_TEST : RTEMS.BOOLEAN; + +-- +-- EXIT_TEST +-- +-- DESCRIPTION: +-- +-- This subprogram is invoked to stop this test. +-- + + procedure EXIT_TEST; + +-- +-- DELAYED_SEND_EVENT +-- +-- DESCRIPTION: +-- +-- This subprogram is a timer service routine which sends an +-- event set to a waiting task. +-- + + procedure DELAYED_SEND_EVENT ( + TIMER_ID : in RTEMS.ID; + IGNORED_ADDRESS : in RTEMS.ADDRESS + ); + +-- +-- INIT +-- +-- DESCRIPTION: +-- +-- This RTEMS task initializes the application. +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ); + +-- +-- TEST_TASK +-- +-- DESCRIPTION: +-- +-- This is one of the test tasks. +-- + + procedure TEST_TASK ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ); + +-- +-- DELAYED_EVENTS_TASK +-- +-- DESCRIPTION: +-- +-- This is one of the test tasks. +-- + + procedure DELAYED_EVENTS_TASK ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ); + +-- +-- MESSAGE_QUEUE_TASK +-- +-- DESCRIPTION: +-- +-- This is one of the test tasks. +-- + + procedure MESSAGE_QUEUE_TASK ( + INDEX : in RTEMS.TASK_ARGUMENT + ); + +-- +-- PARTITION_TASK +-- +-- DESCRIPTION: +-- +-- This is one of the test tasks. +-- + + procedure PARTITION_TASK ( + IGNORED : in RTEMS.TASK_ARGUMENT + ); + +-- +-- SEMAPHORE_TASK +-- +-- DESCRIPTION: +-- +-- This is one of the test tasks. +-- + + procedure SEMAPHORE_TASK ( + ARGUMENT : in RTEMS.TASK_ARGUMENT + ); + +-- +-- This is the Driver Address Table for this test. +-- + + DEVICE_DRIVERS : aliased RTEMS.DRIVER_ADDRESS_TABLE( 1 .. 1 ) := + (1=> + ( + CLOCK_DRIVER.INITIALIZE'ACCESS, -- Initialization + RTEMS.NO_DRIVER_ENTRY, -- Open + RTEMS.NO_DRIVER_ENTRY, -- Close + RTEMS.NO_DRIVER_ENTRY, -- Read + RTEMS.NO_DRIVER_ENTRY, -- Write + RTEMS.NO_DRIVER_ENTRY -- Control + ) + ); + +-- +-- This is the Initialization Tasks Table for this test. +-- + + INITIALIZATION_TASKS : aliased RTEMS.INITIALIZATION_TASKS_TABLE( 1 .. 1 ) := + (1=> + ( + RTEMS.BUILD_NAME( 'U', 'I', '1', ' ' ), -- task name + 2048, -- stack size + 1, -- priority + RTEMS.DEFAULT_ATTRIBUTES, -- attributes + MPTEST.INIT'ACCESS, -- entry point + RTEMS.TIMESLICE, -- initial mode + 0 -- argument list + ) + ); + +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- +-- BEGIN SUBPACKAGE -- +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- + + -- + -- MPTEST.PER_NODE_CONFIGURATION / SPECIFICATION + -- + -- DESCRIPTION: + -- + -- This package is the specification for the subpackage + -- which will define the per node configuration parameters. + -- + + package PER_NODE_CONFIGURATION is + + -- + -- LOCAL_NODE_NUMBER + -- + -- DESCRIPTION: + -- + -- This function returns the node number for this node. + -- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32; + + pragma INLINE ( LOCAL_NODE_NUMBER ); + + end PER_NODE_CONFIGURATION; + +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- +-- END SUBPACKAGE -- +---------------------------------------------------------------------------- +---------------------------------------------------------------------------- + +-- +-- This is the Multiprocessor Configuration Table for this test. +-- + + MULTIPROCESSING_CONFIGURATION : aliased RTEMS.MULTIPROCESSING_TABLE := ( + MPTEST.PER_NODE_CONFIGURATION.LOCAL_NODE_NUMBER, + 2, -- maximum # nodes in system + 32, -- maximum # global objects + 32 -- maximum # proxies + ); + +-- +-- This is the Configuration Table for this test. +-- + + CONFIGURATION : aliased RTEMS.CONFIGURATION_TABLE := ( + RTEMS.NULL_ADDRESS, -- will be replaced by BSP + 64 * 1024, -- executive RAM size + 10, -- maximum # tasks + 12, -- maximum # timers + 1, -- maximum # semaphores + 1, -- maximum # message queues + 1, -- maximum # messages + 1, -- maximum # partitions + 0, -- maximum # regions + 0, -- maximum # dp memory areas + 0, -- maximum # periods + 0, -- maximum # user extensions + RTEMS.MILLISECONDS_TO_MICROSECONDS(10), -- # us in a tick + 1 -- # ticks in a timeslice + ); + +end MPTEST; diff --git a/c/src/ada-tests/mptests/mp14/node1/mptest-per_node_configuration.adb b/c/src/ada-tests/mptests/mp14/node1/mptest-per_node_configuration.adb new file mode 100644 index 0000000000..77430d518f --- /dev/null +++ b/c/src/ada-tests/mptests/mp14/node1/mptest-per_node_configuration.adb @@ -0,0 +1,43 @@ +-- +-- MPTEST.PER_NODE_CONFIGURATION / BODY +-- +-- DESCRIPTION: +-- +-- This package is the specification for the subpackage +-- which will define the per node configuration parameters. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest-per_node_configuration.adb,v 1.2 1995/05/31 16:35:50 joel Exp +-- + +with RTEMS; + +separate ( MPTEST ) + +package body PER_NODE_CONFIGURATION is + +--PAGE +-- +-- LOCAL_NODE_NUMBER +-- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32 is + begin + + return 1; + + end LOCAL_NODE_NUMBER; + +end PER_NODE_CONFIGURATION; diff --git a/c/src/ada-tests/mptests/mp14/node2/mptest-per_node_configuration.adb b/c/src/ada-tests/mptests/mp14/node2/mptest-per_node_configuration.adb new file mode 100644 index 0000000000..f0c6fb16da --- /dev/null +++ b/c/src/ada-tests/mptests/mp14/node2/mptest-per_node_configuration.adb @@ -0,0 +1,43 @@ +-- +-- MPTEST.PER_NODE_CONFIGURATION / BODY +-- +-- DESCRIPTION: +-- +-- This package is the specification for the subpackage +-- which will define the per node configuration parameters. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993, 1994. +-- On-Line Applications Research Corporation (OAR). +-- All rights assigned to U.S. Government, 1994. +-- +-- This material may be reproduced by or for the U.S. Government pursuant +-- to the copyright license under the clause at DFARS 252.227-7013. This +-- notice must appear in all copies of this file and its derivatives. +-- +-- mptest-per_node_configuration.adb,v 1.2 1995/05/31 16:36:00 joel Exp +-- + +with RTEMS; + +separate ( MPTEST ) + +package body PER_NODE_CONFIGURATION is + +--PAGE +-- +-- LOCAL_NODE_NUMBER +-- + + function LOCAL_NODE_NUMBER + return RTEMS.UNSIGNED32 is + begin + + return 2; + + end LOCAL_NODE_NUMBER; + +end PER_NODE_CONFIGURATION; |