diff options
Diffstat (limited to 'testsuites/ada/samples/base_sp')
-rw-r--r-- | testsuites/ada/samples/base_sp/Makefile.am | 19 | ||||
-rw-r--r-- | testsuites/ada/samples/base_sp/ada_base_sp.scn | 4 | ||||
-rw-r--r-- | testsuites/ada/samples/base_sp/base_sp.adb | 56 | ||||
-rw-r--r-- | testsuites/ada/samples/base_sp/config.h | 30 | ||||
-rw-r--r-- | testsuites/ada/samples/base_sp/sptest.adb | 93 | ||||
-rw-r--r-- | testsuites/ada/samples/base_sp/sptest.ads | 60 |
6 files changed, 262 insertions, 0 deletions
diff --git a/testsuites/ada/samples/base_sp/Makefile.am b/testsuites/ada/samples/base_sp/Makefile.am new file mode 100644 index 0000000000..c6b2628735 --- /dev/null +++ b/testsuites/ada/samples/base_sp/Makefile.am @@ -0,0 +1,19 @@ +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am + +include $(top_srcdir)/ada.am + +ada_base_sp$(EXEEXT): base_sp.adb init.$(OBJEXT) + $(GNATCOMPILE) -margs -a $< -o $@ + +init.$(OBJEXT): ../../support/init.c + $(COMPILE.c) -I$(srcdir) -c $< + +noinst_PROGRAMS = ada_base_sp + +ada_base_sp_SOURCES = base_sp.adb config.h sptest.adb sptest.ads + +scndir = $(rtems_ada_testsdir) +dist_scn_DATA = ada_base_sp.scn + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/ada/samples/base_sp/ada_base_sp.scn b/testsuites/ada/samples/base_sp/ada_base_sp.scn new file mode 100644 index 0000000000..7b8867dc85 --- /dev/null +++ b/testsuites/ada/samples/base_sp/ada_base_sp.scn @@ -0,0 +1,4 @@ +*** SAMPLE SINGLE PROCESSOR APPLICATION *** +Creating and starting an application task +Application task was invoked with argument ( 0) and has id of 0x16#A010002# +*** END OF SAMPLE SINGLE PROCESSOR APPLICATION *** diff --git a/testsuites/ada/samples/base_sp/base_sp.adb b/testsuites/ada/samples/base_sp/base_sp.adb new file mode 100644 index 0000000000..aaa1ab3bca --- /dev/null +++ b/testsuites/ada/samples/base_sp/base_sp.adb @@ -0,0 +1,56 @@ +-- +-- MAIN / BODY +-- +-- DESCRIPTION: +-- +-- This is the entry point for Base Single Process Example of the +-- Sample Test Suite. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989-2011. +-- On-Line Applications Research Corporation (OAR). +-- +-- The license and distribution terms for this file may in +-- the file LICENSE in this distribution or at +-- http://www.rtems.org/license/LICENSE. +-- + +with RTEMS; +with RTEMS.TASKS; +with SPTEST; +with TEST_SUPPORT; + +procedure Base_SP is + INIT_ID : RTEMS.ID; + STATUS : RTEMS.STATUS_CODES; +begin + + RTEMS.TASKS.CREATE( + RTEMS.BUILD_NAME( 'I', 'N', 'I', 'T' ), + 1, + RTEMS.MINIMUM_STACK_SIZE, + RTEMS.NO_PREEMPT, + RTEMS.DEFAULT_ATTRIBUTES, + INIT_ID, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF INIT" ); + + + RTEMS.TASKS.START( + INIT_ID, + SPTEST.INIT'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF INIT" ); + + loop + delay 120.0; + end loop; + +end Base_SP; + diff --git a/testsuites/ada/samples/base_sp/config.h b/testsuites/ada/samples/base_sp/config.h new file mode 100644 index 0000000000..083d52515e --- /dev/null +++ b/testsuites/ada/samples/base_sp/config.h @@ -0,0 +1,30 @@ +/* config.h + * + * This include file defines the Configuration Table for this test. + * + * COPYRIGHT (c) 1989-2007. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may in + * the file LICENSE in this distribution or at + * http://www.rtems.org/license/LICENSE. + */ + + +/* configuration information */ + +#define CONFIGURE_SPTEST + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_POSIX_INIT_THREAD_TABLE + +#define CONFIGURE_MAXIMUM_POSIX_THREADS 10 +#define CONFIGURE_MAXIMUM_POSIX_KEYS 10 + +#define CONFIGURE_MAXIMUM_TASKS 2 + +#include <rtems/confdefs.h> + +/* end of include file */ diff --git a/testsuites/ada/samples/base_sp/sptest.adb b/testsuites/ada/samples/base_sp/sptest.adb new file mode 100644 index 0000000000..85a847f281 --- /dev/null +++ b/testsuites/ada/samples/base_sp/sptest.adb @@ -0,0 +1,93 @@ +-- +-- SPTEST / BODY +-- +-- DESCRIPTION: +-- +-- This package is the implementation of Test 1 of the RTEMS +-- Single Processor Test Suite. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989-2011. +-- On-Line Applications Research Corporation (OAR). +-- +-- The license and distribution terms for this file may in +-- the file LICENSE in this distribution or at +-- http://www.rtems.org/license/LICENSE. +-- + +with TEST_SUPPORT; +with TEXT_IO; +with UNSIGNED32_IO; + +package body SPTEST is + +-- +-- INIT +-- + + procedure INIT ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ) is + pragma Unreferenced(ARGUMENT); + STATUS : RTEMS.STATUS_CODES; + begin + + TEXT_IO.NEW_LINE( 2 ); + TEXT_IO.PUT_LINE( "*** SAMPLE SINGLE PROCESSOR APPLICATION ***" ); + TEXT_IO.PUT_LINE( "Creating and starting an application task" ); + + SPTEST.TASK_NAME( 1 ) := RTEMS.BUILD_NAME( 'T', 'A', '1', ' ' ); + + RTEMS.TASKS.CREATE( + SPTEST.TASK_NAME( 1 ), + 1, + 2048, + RTEMS.INTERRUPT_LEVEL( 0 ), + RTEMS.DEFAULT_ATTRIBUTES, + SPTEST.TASK_ID( 1 ), + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_CREATE OF TA1" ); + + RTEMS.TASKS.START( + SPTEST.TASK_ID( 1 ), + SPTEST.APPLICATION_TASK'ACCESS, + 0, + STATUS + ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_START OF TA1" ); + + RTEMS.TASKS.DELETE( RTEMS.SELF, STATUS ); + TEST_SUPPORT.DIRECTIVE_FAILED( STATUS, "TASK_DELETE OF SELF" ); + + end INIT; + +-- +-- APPLICATION_TASK +-- + + procedure APPLICATION_TASK ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ) is + TID : RTEMS.ID; + STATUS : RTEMS.STATUS_CODES; + begin + + RTEMS.TASKS.IDENT( RTEMS.SELF, RTEMS.SEARCH_ALL_NODES, TID, STATUS ); + + TEXT_IO.PUT( "Application task was invoked with argument (" ); + UNSIGNED32_IO.PUT( ARGUMENT ); + TEXT_IO.PUT( ") and has id of 0x" ); + UNSIGNED32_IO.PUT( TID, BASE => 16 ); + TEXT_IO.NEW_LINE; + + TEXT_IO.PUT_LINE( "*** END OF SAMPLE SINGLE PROCESSOR APPLICATION ***" ); + + RTEMS.SHUTDOWN_EXECUTIVE( 0 ); + + end APPLICATION_TASK; + +end SPTEST; diff --git a/testsuites/ada/samples/base_sp/sptest.ads b/testsuites/ada/samples/base_sp/sptest.ads new file mode 100644 index 0000000000..e35751cd32 --- /dev/null +++ b/testsuites/ada/samples/base_sp/sptest.ads @@ -0,0 +1,60 @@ +-- +-- SPTEST / SPECIFICATION +-- +-- DESCRIPTION: +-- +-- This package is the specification for Test 1 of the RTEMS +-- Single Processor Test Suite. +-- +-- DEPENDENCIES: +-- +-- +-- +-- COPYRIGHT (c) 1989-2011. +-- On-Line Applications Research Corporation (OAR). +-- +-- The license and distribution terms for this file may in +-- the file LICENSE in this distribution or at +-- http://www.rtems.org/license/LICENSE. +-- + +with RTEMS; +with RTEMS.TASKS; + +package SPTEST 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.TASKS.ARGUMENT + ); + pragma Convention (C, INIT); + +-- +-- APPLICATION_TASK +-- +-- DESCRIPTION: +-- +-- This is the body of the RTEMS task which constitutes this test. +-- + + procedure APPLICATION_TASK ( + ARGUMENT : in RTEMS.TASKS.ARGUMENT + ); + pragma Convention (C, APPLICATION_TASK); + +end SPTEST; |