From 6d4e604be8b43c0555cd1c9531fe78ae199a1189 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 2 Jun 1997 20:19:03 +0000 Subject: Initial revision --- c/src/ada-tests/mptests/mp05/mptest.adb | 252 +++++++++++++++++++++ c/src/ada-tests/mptests/mp05/mptest.ads | 244 ++++++++++++++++++++ .../mp05/node1/mptest-per_node_configuration.adb | 43 ++++ .../mp05/node2/mptest-per_node_configuration.adb | 43 ++++ 4 files changed, 582 insertions(+) create mode 100644 c/src/ada-tests/mptests/mp05/mptest.adb create mode 100644 c/src/ada-tests/mptests/mp05/mptest.ads create mode 100644 c/src/ada-tests/mptests/mp05/node1/mptest-per_node_configuration.adb create mode 100644 c/src/ada-tests/mptests/mp05/node2/mptest-per_node_configuration.adb (limited to 'c/src/ada-tests/mptests/mp05') 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; -- cgit v1.2.3