summaryrefslogtreecommitdiffstats
path: root/c/src/ada-tests/mptests/mp02
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>1997-06-02 20:19:03 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>1997-06-02 20:19:03 +0000
commit6d4e604be8b43c0555cd1c9531fe78ae199a1189 (patch)
treeadc303bfeaddf541a8f45ea1597f43bf8bf7a09d /c/src/ada-tests/mptests/mp02
parentChanged bitwise OR's used to build up option and attribute sets (diff)
downloadrtems-6d4e604be8b43c0555cd1c9531fe78ae199a1189.tar.bz2
Initial revision
Diffstat (limited to 'c/src/ada-tests/mptests/mp02')
-rw-r--r--c/src/ada-tests/mptests/mp02/mptest.adb213
-rw-r--r--c/src/ada-tests/mptests/mp02/mptest.ads165
-rw-r--r--c/src/ada-tests/mptests/mp02/node1/mptest-per_node_configuration.adb43
-rw-r--r--c/src/ada-tests/mptests/mp02/node2/mptest-per_node_configuration.adb43
4 files changed, 464 insertions, 0 deletions
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;