2003-11-10 Ralf Corsepius <corsepiu@faw.uni-ulm.de>

* cpuuse/.cvsignore: Remove.
	* cpuuse/Makefile.am: Remove.
	* cpuuse/cpuuse.scn: Remove.
	* cpuuse/init.c: Remove.
	* cpuuse/system.h: Remove.
	* cpuuse/task1.c: Remove.
	* cpuuse/task2.c: Remove.
	* cpuuse/task3.c: Remove.
	* cpuuse/tswitch.c: Remove.
	* .cvsignore: Remove.
	* ChangeLog: Remove.
	* Makefile.am: Remove.
	* README: Remove.
	* configure.ac: Remove.
	* libtests.am: Remove.
	* malloctest/.cvsignore: Remove.
	* malloctest/Makefile.am: Remove.
	* malloctest/init.c: Remove.
	* malloctest/malloctest.scn: Remove.
	* malloctest/system.h: Remove.
	* malloctest/task1.c: Remove.
	* monitor/.cvsignore: Remove.
	* monitor/Makefile.am: Remove.
	* monitor/init.c: Remove.
	* monitor/system.h: Remove.
	* putenvtest/.cvsignore: Remove.
	* putenvtest/Makefile.am: Remove.
	* putenvtest/init.c: Remove.
	* rtems++/.cvsignore: Remove.
	* rtems++/Init.cc: Remove.
	* rtems++/Makefile.am: Remove.
	* rtems++/System.h: Remove.
	* rtems++/Task1.cc: Remove.
	* rtems++/Task2.cc: Remove.
	* rtems++/Task3.cc: Remove.
	* rtems++/rtems++.doc: Remove.
	* rtems++/rtems++.scn: Remove.
	* rtmonuse/.cvsignore: Remove.
	* rtmonuse/Makefile.am: Remove.
	* rtmonuse/getall.c: Remove.
	* rtmonuse/init.c: Remove.
	* rtmonuse/rtmonuse.scn: Remove.
	* rtmonuse/system.h: Remove.
	* rtmonuse/task1.c: Remove.
	* stackchk/.cvsignore: Remove.
	* stackchk/Makefile.am: Remove.
	* stackchk/blow.c: Remove.
	* stackchk/init.c: Remove.
	* stackchk/stackchk.scn: Remove.
	* stackchk/system.h: Remove.
	* stackchk/task1.c: Remove.
	* termios/.cvsignore: Remove.
	* termios/Makefile.am: Remove.
	* termios/README: Remove.
	* termios/init.c: Remove.
This commit is contained in:
Ralf Corsepius
2003-11-11 00:54:36 +00:00
parent c727a7eb3b
commit 04e934a89e
55 changed files with 0 additions and 4711 deletions

View File

@@ -1,14 +0,0 @@
aclocal.m4
autom4te*.cache
config.cache
config.guess
config.log
config.status
config.sub
configure
depcomp
install-sh
Makefile
Makefile.in
missing
mkinstalldirs

View File

@@ -1,226 +0,0 @@
2003-11-10 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* cpuuse/.cvsignore: Remove.
* cpuuse/Makefile.am: Remove.
* cpuuse/cpuuse.scn: Remove.
* cpuuse/init.c: Remove.
* cpuuse/system.h: Remove.
* cpuuse/task1.c: Remove.
* cpuuse/task2.c: Remove.
* cpuuse/task3.c: Remove.
* cpuuse/tswitch.c: Remove.
* .cvsignore: Remove.
* ChangeLog: Remove.
* Makefile.am: Remove.
* README: Remove.
* configure.ac: Remove.
* libtests.am: Remove.
* malloctest/.cvsignore: Remove.
* malloctest/Makefile.am: Remove.
* malloctest/init.c: Remove.
* malloctest/malloctest.scn: Remove.
* malloctest/system.h: Remove.
* malloctest/task1.c: Remove.
* monitor/.cvsignore: Remove.
* monitor/Makefile.am: Remove.
* monitor/init.c: Remove.
* monitor/system.h: Remove.
* putenvtest/.cvsignore: Remove.
* putenvtest/Makefile.am: Remove.
* putenvtest/init.c: Remove.
* rtems++/.cvsignore: Remove.
* rtems++/Init.cc: Remove.
* rtems++/Makefile.am: Remove.
* rtems++/System.h: Remove.
* rtems++/Task1.cc: Remove.
* rtems++/Task2.cc: Remove.
* rtems++/Task3.cc: Remove.
* rtems++/rtems++.doc: Remove.
* rtems++/rtems++.scn: Remove.
* rtmonuse/.cvsignore: Remove.
* rtmonuse/Makefile.am: Remove.
* rtmonuse/getall.c: Remove.
* rtmonuse/init.c: Remove.
* rtmonuse/rtmonuse.scn: Remove.
* rtmonuse/system.h: Remove.
* rtmonuse/task1.c: Remove.
* stackchk/.cvsignore: Remove.
* stackchk/Makefile.am: Remove.
* stackchk/blow.c: Remove.
* stackchk/init.c: Remove.
* stackchk/stackchk.scn: Remove.
* stackchk/system.h: Remove.
* stackchk/task1.c: Remove.
* termios/.cvsignore: Remove.
* termios/Makefile.am: Remove.
* termios/README: Remove.
* termios/init.c: Remove.
2003-10-22 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* configure.ac: Remove RTEMS_CANONICAL_HOST.
2003-10-02 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* configure.ac:Remove RTEMS_CHECK_CPU.
2003-09-04 Joel Sherrill <joel@OARcorp.com>
* cpuuse/init.c, cpuuse/system.h, cpuuse/task1.c, cpuuse/task2.c,
cpuuse/task3.c, cpuuse/tswitch.c, malloctest/init.c,
malloctest/system.h, malloctest/task1.c, monitor/init.c,
monitor/system.h, putenvtest/init.c, rtems++/Init.cc,
rtems++/System.h, rtems++/Task1.cc, rtems++/Task2.cc,
rtems++/Task3.cc, rtems++/rtems++.doc, rtmonuse/getall.c,
rtmonuse/init.c, rtmonuse/system.h, rtmonuse/task1.c,
stackchk/blow.c, stackchk/init.c, stackchk/system.h,
stackchk/task1.c: URL for license changed.
2003-08-18 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* Makefile.am: Reflect having moved aclocal/.
2003-08-16 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* Makefile.am: Reflect having moved automake/.
* cpuuse/Makefile.am: Reflect having moved automake/.
* malloctest/Makefile.am: Reflect having moved automake/.
* monitor/Makefile.am: Reflect having moved automake/.
* putenvtest/Makefile.am: Reflect having moved automake/.
* rtems++/Makefile.am: Reflect having moved automake/.
* rtmonuse/Makefile.am: Reflect having moved automake/.
* stackchk/Makefile.am: Reflect having moved automake/.
* termios/Makefile.am: Reflect having moved automake/.
2003-08-11 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* configure.ac: Use rtems-bugs@rtems.com as bug report email address.
2003-03-06 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* configure.ac: Remove AC_CONFIG_AUX_DIR.
2003-02-03 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* configure.ac: Unconditionally check for CXX.
Require autoconf-2.57, automake-1.7.2.
* rtems++: Eliminate CC_O_FILES.
2002-12-02 Joel Sherrill <joel@OARcorp.com>
* malloctest/init.c: Tasks should be floating point.
2002-10-21 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* .cvsignore: Reformat.
Add autom4te*cache.
Remove autom4te.cache.
2002-08-11 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* cpuuse/Makefile.am: Use $(OBJEXT) instead of .o.
* malloctest/Makefile.am: Use $(OBJEXT) instead of .o.
* monitor/Makefile.am: Use $(OBJEXT) instead of .o.
* putenvtest/Makefile.am: Use $(OBJEXT) instead of .o.
* rtems++/Makefile.am: Use $(OBJEXT) instead of .o.
* rtmonuse/Makefile.am: Use $(OBJEXT) instead of .o.
* stackchk/Makefile.am: Use $(OBJEXT) instead of .o.
* termios/Makefile.am: Use $(OBJEXT) instead of .o.
2002-08-01 Joel Sherrill <joel@OARcorp.com>
* Per PR47 add support for buffered test output. This involved
adding defines to redirect output to a buffer and dump it when
full, at "test pause", and at exit. To avoid problems when redefining
exit(), all tests were modified to call rtems_test_exit().
Some tests, notable psxtests, had to be modified to include
the standard test macro .h file (pmacros.h or tmacros.h) to
enable this support.
* cpuuse/task2.c, malloctest/task1.c, putenvtest/init.c,
rtmonuse/task1.c, termios/init.c: Modified.
2002-04-14 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* configure.ac: Remove ENABLE_GCC28.
2002-03-27 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* configure.ac:
AC_INIT(package,_RTEMS_VERSION,_RTEMS_BUGS).
AM_INIT_AUTOMAKE([no-define foreign 1.6]).
* cpuuse/Makefile.am: Remove AUTOMAKE_OPTIONS.
* Makefile.am: Remove AUTOMAKE_OPTIONS.
* malloctest/Makefile.am: Remove AUTOMAKE_OPTIONS.
* monitor/Makefile.am: Remove AUTOMAKE_OPTIONS.
* putenvtest/Makefile.am: Remove AUTOMAKE_OPTIONS.
* rtems++/Makefile.am: Remove AUTOMAKE_OPTIONS.
* rtmonuse/Makefile.am: Remove AUTOMAKE_OPTIONS.
* stackchk/Makefile.am: Remove AUTOMAKE_OPTIONS.
* termios/Makefile.am: Remove AUTOMAKE_OPTIONS.
2001-11-01 Joel Sherrill <joel@OARcorp.com>
* rtems++/Makefile.am: Make sure debug variant of librtems++
is linked against. Reported by Jerry Needell <jerry.needell@unh.edu>
and processed as PR78.
2001-10-25 Joel Sherrill <joel@OARcorp.com>
* rtems++/Makefile.am: Pick up -lrtems++ even when debug.
2001-10-11 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* .cvsignore: Add autom4te.cache for autoconf > 2.52.
* configure.in: Remove.
* configure.ac: New file, generated from configure.in by autoupdate.
2001-09-22 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* libtests.am: Use TMPINSTALL_FILES = to make automake-1.5 happy.
* rtems++/Makefile.am: LD_FLAGS = -lrtems++.
2001-09-19 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* malloctest/Makefile.am: include leaf.am instead of leaf.cfg.
* monitor/Makefile.am: include leaf.am instead of leaf.cfg.
* termios/Makefile.am: include leaf.am instead of leaf.cfg.
* putenvtest/Makefile.am: include leaf.am instead of leaf.cfg.
* rtems++/Makefile.am: include leaf.am instead of leaf.cfg, use
make-cxx-exe.
* stackchk/Makefile.am: include leaf.am instead of leaf.cfg.
* rtmonuse/Makefile.am: include leaf.am instead of leaf.cfg.
* cpuuse/Makefile.am: include leaf.am instead of leaf.cfg.
2001-05-10 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* configure.in: Use RTEMS_PROG_CC_FOR_TARGET([-ansi -fasm]).
2000-11-09 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* Makefile.am: Use ... instead of RTEMS_TOPdir in ACLOCAL_AMFLAGS.
2000-11-02 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* Makefile.am: Switch to ACLOCAL_AMFLAGS = -I $(RTEMS_TOPdir)/aclocal.
2000-11-01 Joel Sherrill <joel@OARcorp.com>
* malloctest/task1.c: assoc.h, error.h, libio_.h, libio.h, and
libcsupport.h moved from libc to lib/include/rtems and now must
be referenced as <rtems/XXX.h>.
2000-10-27 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* Makefile.am: ACLOCAL_AMFLAGS= -I $(RTEMS_TOPdir)/macros.
Switch to GNU canonicalization.
* libtests.am: Remove DEFS.
2000-09-04 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
* cpuuse/Makefile.am, malloctest/Makefile.am, monitor/Makefile.am,
putenvtest/Makefile.am, rtems++/Makefile.am, rtmonuse/Makefile.am,
stackchk/Makefile.am, termios/Makefile.am: Include compile.am
2000-08-10 Joel Sherrill <joel@OARcorp.com>
* ChangeLog: New file.

View File

@@ -1,13 +0,0 @@
##
## $Id$
##
ACLOCAL_AMFLAGS = -I ../aclocal
SUBDIRS = cpuuse malloctest putenvtest monitor rtmonuse stackchk termios \
rtems++
EXTRA_DIST = libtests.am
include $(top_srcdir)/../automake/subdirs.am
include $(top_srcdir)/../automake/local.am

View File

@@ -1,10 +0,0 @@
#
# $Id$
#
This directory contains tests for some of the items in
the lib directories. The intent is to be able to
verify the basic functionality of a library. For example,
it is important to know that the stack checker successfully
detects tasks which both stay within and exceed their
stack limits.

View File

@@ -1,48 +0,0 @@
## Process this file with autoconf to produce a configure script.
##
## $Id$
AC_PREREQ(2.57)
AC_INIT([rtems-c-src-tests-libtests],[_RTEMS_VERSION],[rtems-bugs@rtems.com])
AC_CONFIG_SRCDIR([cpuuse])
RTEMS_TOP(../../../..)
RTEMS_CANONICAL_TARGET_CPU
AM_INIT_AUTOMAKE([no-define foreign 1.7.2])
AM_MAINTAINER_MODE
RTEMS_ENABLE_CXX
RTEMS_ENABLE_BARE
RTEMS_ENV_RTEMSBSP
RTEMS_CHECK_RTEMS_TEST_NO_PAUSE
RTEMS_PROJECT_ROOT
RTEMS_PROG_CC_FOR_TARGET([-ansi -fasm])
RTEMS_PROG_CXX_FOR_TARGET
RTEMS_CANONICALIZE_TOOLS
RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)
RTEMS_CHECK_CXX(RTEMS_BSP)
AC_SUBST(BARE_CPU_CFLAGS)
AC_SUBST(BARE_CPU_MODEL)
AM_CONDITIONAL(HAS_CXX,test "$HAS_CPLUSPLUS" = "yes")
# Explicitly list all Makefiles here
AC_CONFIG_FILES([Makefile
cpuuse/Makefile
malloctest/Makefile
monitor/Makefile
putenvtest/Makefile
rtems++/Makefile
rtmonuse/Makefile
stackchk/Makefile
termios/Makefile
])
AC_OUTPUT

View File

@@ -1,2 +0,0 @@
Makefile
Makefile.in

View File

@@ -1,42 +0,0 @@
##
## $Id$
##
TEST = cpuuse
MANAGERS = io rate_monotonic
C_FILES = init.c task1.c task2.c task3.c tswitch.c
C_O_FILES = $(C_FILES:%.c=${ARCH}/%.$(OBJEXT))
H_FILES = system.h
noinst_HEADERS = $(H_FILES)
DOCTYPES = scn
DOCS = $(DOCTYPES:%=$(TEST).%)
SRCS = $(DOCS) $(C_FILES) $(H_FILES)
OBJS = $(C_O_FILES)
PRINT_SRCS = $(DOCS)
PGM = ${ARCH}/$(TEST).exe
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../automake/compile.am
include $(top_srcdir)/../automake/leaf.am
include $(top_srcdir)/libtests.am
#
# (OPTIONAL) Add local stuff here using +=
#
${PGM}: $(OBJS) $(LINK_FILES)
$(make-exe)
all-local: $(ARCH) $(TMPINSTALL_FILES)
EXTRA_DIST = $(C_FILES) $(DOCS)
include $(top_srcdir)/../automake/local.am

View File

@@ -1,34 +0,0 @@
*** CPU USAGE LIBRARY TEST ***
TA1 - rtems_task_suspend - on Task 2
TA1 - rtems_task_suspend - on Task 3
TA1 - killing time
TA1 - rtems_task_resume - on Task 2
TA1 - rtems_task_resume - on Task 3
TA1 - rtems_task_mode - change mode to NO RTEMS_PREEMPT
TA1 - 09:15:10 12/31/1988
TA1 - 09:15:11 12/31/1988
TA1 - 09:15:12 12/31/1988
TA1 - 09:15:13 12/31/1988
TA1 - 09:15:14 12/31/1988
TA1 - 09:15:15 12/31/1988
TA1 - rtems_task_mode - change mode to RTEMS_PREEMPT
TA1 - 09:15:00 12/31/1988
TA2 - 09:15:04 12/31/1988
TA3 - 09:15:05 12/31/1988
TA1 - 09:15:06 12/31/1988
TA2 - 09:15:07 12/31/1988
TA3 - 09:15:08 12/31/1988
TA1 - 09:15:09 12/31/1988
TA2 - 09:15:16 12/31/1988
CPU Usage by thread
ID NAME TICKS PERCENT
0x04010001 IDLE 0 0.000
0x08010002 TA1 1203 0.748
0x08010003 TA2 204 0.127
0x08010004 TA3 202 0.126
Ticks since last reset = 1601
Total Units = 1609
*** END OF CPU USAGE LIBRARY TEST ***
NOTE: Actual time per task will vary but there should be no IDLE time.

View File

@@ -1,105 +0,0 @@
/*
* This is a clone of sp04 which has been modified to use the cpu monitoring
* library.
*
* Input parameters:
* argument - task argument
*
* Output parameters: NONE
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#define TEST_INIT
#include "system.h"
rtems_extensions_table Extensions = {
NULL, /* task create user extension */
NULL, /* task start user extension */
NULL, /* task restart user extension */
NULL, /* task delete user extension */
Task_switch, /* task switch user extension */
NULL, /* task begin user extension */
NULL, /* task exitted user extension */
NULL /* fatal error user extension */
};
rtems_task Init(
rtems_task_argument argument
)
{
rtems_status_code status;
rtems_time_of_day time;
puts( "\n\n*** CPU USAGE LIBRARY TEST ***" );
build_time( &time, 12, 31, 1988, 9, 15, 0, 0 );
status = rtems_clock_set( &time );
directive_failed( status, "rtems_clock_set" );
Extension_name[ 1 ] = rtems_build_name( 'E', 'X', 'T', ' ' );
status = rtems_extension_create(
Extension_name[ 1 ],
&Extensions,
&Extension_id[ 1 ]
);
directive_failed( status, "rtems_extension_create" );
Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
Run_count[ 1 ] = 0;
Run_count[ 2 ] = 0;
Run_count[ 3 ] = 0;
status = rtems_task_create(
Task_name[ 1 ],
1,
RTEMS_MINIMUM_STACK_SIZE * 2,
RTEMS_TIMESLICE,
RTEMS_FLOATING_POINT,
&Task_id[ 1 ]
);
directive_failed( status, "rtems_task_create of TA1" );
status = rtems_task_create(
Task_name[ 2 ],
1,
RTEMS_MINIMUM_STACK_SIZE * 2,
RTEMS_TIMESLICE,
RTEMS_FLOATING_POINT,
&Task_id[ 2 ]
);
directive_failed( status, "rtems_task_create of TA2" );
status = rtems_task_create(
Task_name[ 3 ],
1,
RTEMS_MINIMUM_STACK_SIZE * 2,
RTEMS_TIMESLICE,
RTEMS_FLOATING_POINT,
&Task_id[ 3 ]
);
directive_failed( status, "rtems_task_create of TA3" );
status = rtems_task_start( Task_id[ 1 ], Task_1, 0 );
directive_failed( status, "rtems_task_start of TA1" );
status = rtems_task_start( Task_id[ 2 ], Task_2, 0 );
directive_failed( status, "rtems_task_start of TA2" );
status = rtems_task_start( Task_id[ 3 ], Task_3, 0 );
directive_failed( status, "rtems_task_start of TA3" );
status = rtems_task_delete( RTEMS_SELF );
directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
}

View File

@@ -1,81 +0,0 @@
/* system.h
*
* This include file contains information that is included in every
* function in the test set.
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#include <tmacros.h>
/* functions */
rtems_task Init(
rtems_task_argument argument
);
rtems_task Task_1(
rtems_task_argument argument
);
rtems_task Task_2(
rtems_task_argument argument
);
rtems_task Task_3(
rtems_task_argument argument
);
void Task_switch(
rtems_tcb *unused,
rtems_tcb *heir
);
/* configuration information */
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1
#define CONFIGURE_MAXIMUM_TASKS 4
#define CONFIGURE_TICKS_PER_TIMESLICE 100
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_EXTRA_TASK_STACKS (6 * RTEMS_MINIMUM_STACK_SIZE)
#include <confdefs.h>
/* global variables */
TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
TEST_EXTERN rtems_id Extension_id[ 4 ];
TEST_EXTERN rtems_name Extension_name[ 4 ]; /* array of task names */
/* array of task run counts */
TEST_EXTERN volatile rtems_unsigned32 Run_count[ 4 ];
/*
* Keep track of task switches
*/
struct taskSwitchLog {
int taskIndex;
rtems_time_of_day when;
};
extern struct taskSwitchLog taskSwitchLog[];
extern int taskSwitchLogIndex;
volatile extern int testsFinished;
/* end of include file */

View File

@@ -1,102 +0,0 @@
/* Task_1
*
* This test serves as a test task. It verifies timeslicing activities
* and tswitch extension processing.
*
* Input parameters:
* argument - task argument
*
* Output parameters: NONE
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#include "system.h"
rtems_task Task_1(
rtems_task_argument argument
)
{
rtems_unsigned32 seconds;
rtems_unsigned32 old_seconds;
rtems_mode previous_mode;
rtems_time_of_day time;
rtems_status_code status;
rtems_unsigned32 start_time;
rtems_unsigned32 end_time;
puts( "TA1 - rtems_task_suspend - on Task 2" );
status = rtems_task_suspend( Task_id[ 2 ] );
directive_failed( status, "rtems_task_suspend of TA2" );
puts( "TA1 - rtems_task_suspend - on Task 3" );
status = rtems_task_suspend( Task_id[ 3 ] );
directive_failed( status, "rtems_task_suspend of TA3" );
status = rtems_clock_get( RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH, &start_time );
directive_failed( status, "rtems_clock_get" );
puts( "TA1 - killing time" );
for ( ; ; ) {
status = rtems_clock_get( RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH, &end_time );
directive_failed( status, "rtems_clock_get" );
if ( end_time > (start_time + 2) )
break;
}
puts( "TA1 - rtems_task_resume - on Task 2" );
status = rtems_task_resume( Task_id[ 2 ] );
directive_failed( status, "rtems_task_resume of TA2" );
puts( "TA1 - rtems_task_resume - on Task 3" );
status = rtems_task_resume( Task_id[ 3 ] );
directive_failed( status, "rtems_task_resume of TA3" );
while ( FOREVER ) {
if ( Run_count[ 1 ] == 3 ) {
puts( "TA1 - rtems_task_mode - change mode to NO RTEMS_PREEMPT" );
status = rtems_task_mode(
RTEMS_NO_PREEMPT,
RTEMS_PREEMPT_MASK,
&previous_mode
);
directive_failed( status, "rtems_task_mode" );
status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
directive_failed( status, "rtems_clock_get" );
old_seconds = time.second;
for ( seconds = 0 ; seconds < 6 ; ) {
status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
directive_failed( status, "rtems_clock_get" );
if ( time.second != old_seconds ) {
old_seconds = time.second;
seconds++;
print_time( "TA1 - ", &time, "\n" );
}
}
puts( "TA1 - rtems_task_mode - change mode to RTEMS_PREEMPT" );
status = rtems_task_mode(
RTEMS_PREEMPT,
RTEMS_PREEMPT_MASK,
&previous_mode
);
directive_failed( status, "rtems_task_mode" );
while ( FOREVER );
}
}
}

View File

@@ -1,47 +0,0 @@
/* Task_2
*
* This routine serves as a test task. It is just a CPU bound task
* requiring timesliced operation.
*
* Input parameters:
* argument - task argument
*
* Output parameters: NONE
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#include "system.h"
#include <rtems/cpuuse.h>
static void
showTaskSwitches (void)
{
int i;
int switches = taskSwitchLogIndex;
for (i = 0 ; i < switches ; i++) {
put_name( Task_name[taskSwitchLog[i].taskIndex], FALSE );
print_time( "- ", &taskSwitchLog[i].when, "\n" );
}
}
rtems_task Task_2(
rtems_task_argument argument
)
{
while ( !testsFinished );
showTaskSwitches ();
CPU_usage_Dump();
puts( "*** END OF CPU USAGE LIBRARY TEST ***" );
rtems_test_exit( 0 );
}

View File

@@ -1,28 +0,0 @@
/* Task_3
*
* This routine serves as a test task. It is just a CPU bound task
* requiring timesliced operation.
*
* Input parameters:
* argument - task argument
*
* Output parameters: NONE
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#include "system.h"
rtems_task Task_3(
rtems_task_argument argument
)
{
while( FOREVER );
}

View File

@@ -1,65 +0,0 @@
/* Task_switch
*
* This routine is the tswitch user extension. It determines which
* task is being switched to and displays a message indicating the
* time and date that it gained control.
*
* Input parameters:
* unused - pointer to currently running TCB
* heir - pointer to heir TCB
*
* Output parameters: NONE
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#include "system.h"
struct taskSwitchLog taskSwitchLog[1000];
int taskSwitchLogIndex;
volatile int testsFinished;;
rtems_extension Task_switch(
rtems_tcb *unused,
rtems_tcb *heir
)
{
rtems_unsigned32 index;
rtems_time_of_day time;
rtems_status_code status;
index = task_number( heir->Object.id );
switch( index ) {
case 1:
case 2:
case 3:
Run_count[ index ] += 1;
status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
fatal_directive_status_with_level( status, RTEMS_SUCCESSFUL,
"rtems_clock_get", 1 );
if (taskSwitchLogIndex <
(sizeof taskSwitchLog / sizeof taskSwitchLog[0])) {
taskSwitchLog[taskSwitchLogIndex].taskIndex = index;
taskSwitchLog[taskSwitchLogIndex].when = time;
taskSwitchLogIndex++;
}
if ( time.second >= 16 )
testsFinished = 1;
break;
case 0:
default:
break;
}
}

View File

@@ -1,13 +0,0 @@
## $Id$
project_bspdir=$(PROJECT_ROOT)/@RTEMS_BSP@
$(project_bspdir)/tests:
@$(mkinstalldirs) $@
$(project_bspdir)/tests/$(TEST)$(LIB_VARIANT).exe: $(PGM)
$(INSTALL_PROGRAM) $< $@
TMPINSTALL_FILES = \
$(project_bspdir)/tests \
$(project_bspdir)/tests/$(TEST)$(LIB_VARIANT).exe

View File

@@ -1,2 +0,0 @@
Makefile
Makefile.in

View File

@@ -1,42 +0,0 @@
##
## $Id$
##
TEST = malloctest
MANAGERS = io
C_FILES = init.c task1.c
C_O_FILES = $(C_FILES:%.c=${ARCH}/%.$(OBJEXT))
H_FILES = system.h
noinst_HEADERS = $(H_FILES)
DOCTYPES = scn
DOCS = $(DOCTYPES:%=$(TEST).%)
SRCS = $(DOCS) $(C_FILES) $(CC_FILES) $(H_FILES) $(S_FILES)
OBJS = $(C_O_FILES) $(CC_O_FILES) $(S_O_FILES)
PRINT_SRCS = $(DOCS)
PGM = ${ARCH}/$(TEST).exe
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../automake/compile.am
include $(top_srcdir)/../automake/leaf.am
include $(top_srcdir)/libtests.am
#
# (OPTIONAL) Add local stuff here using +=
#
${PGM}: $(OBJS) $(LINK_FILES)
$(make-exe)
all-local: $(ARCH) $(TMPINSTALL_FILES)
EXTRA_DIST = $(C_FILES) $(DOCS)
include $(top_srcdir)/../automake/local.am

View File

@@ -1,113 +0,0 @@
/* Init
*
* This routine is the initialization task for this test program.
* It is a user initialization task and has the responsibility for creating
* and starting the tasks that make up the test. If the time of day
* clock is required for the test, it should also be set to a known
* value by this function.
*
* Input parameters:
* argument - task argument
*
* Output parameters: NONE
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#define TEST_INIT
#include "system.h"
rtems_task Init(
rtems_task_argument argument
)
{
rtems_time_of_day time;
rtems_status_code status;
puts( "\n\n*** MALLOC TEST ***" );
build_time( &time, 12, 31, 1988, 9, 0, 0, 0 );
status = rtems_clock_set( &time );
directive_failed( status, "rtems_clock_set" );
Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' );
Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' );
status = rtems_task_create(
Task_name[ 1 ],
1,
TASK_STACK_SIZE,
RTEMS_DEFAULT_MODES,
RTEMS_FLOATING_POINT,
&Task_id[ 1 ]
);
directive_failed( status, "rtems_task_create of TA1" );
status = rtems_task_create(
Task_name[ 2 ],
1,
TASK_STACK_SIZE,
RTEMS_DEFAULT_MODES,
RTEMS_FLOATING_POINT,
&Task_id[ 2 ]
);
directive_failed( status, "rtems_task_create of TA2" );
status = rtems_task_create(
Task_name[ 3 ],
1,
TASK_STACK_SIZE,
RTEMS_DEFAULT_MODES,
RTEMS_FLOATING_POINT,
&Task_id[ 3 ]
);
directive_failed( status, "rtems_task_create of TA3" );
status = rtems_task_create(
Task_name[ 4 ],
1,
TASK_STACK_SIZE,
RTEMS_DEFAULT_MODES,
RTEMS_FLOATING_POINT,
&Task_id[ 4 ]
);
directive_failed( status, "rtems_task_create of TA4" );
status = rtems_task_create(
Task_name[ 5 ],
1,
TASK_STACK_SIZE,
RTEMS_DEFAULT_MODES,
RTEMS_FLOATING_POINT,
&Task_id[ 5 ]
);
directive_failed( status, "rtems_task_create of TA5" );
status = rtems_task_start( Task_id[ 1 ], Task_1_through_5, 0 );
directive_failed( status, "rtems_task_start of TA1" );
status = rtems_task_start( Task_id[ 2 ], Task_1_through_5, 0 );
directive_failed( status, "rtems_task_start of TA2" );
status = rtems_task_start( Task_id[ 3 ], Task_1_through_5, 0 );
directive_failed( status, "rtems_task_start of TA3" );
status = rtems_task_start( Task_id[ 4 ], Task_1_through_5, 0 );
directive_failed( status, "rtems_task_start of TA4" );
status = rtems_task_start( Task_id[ 5 ], Task_1_through_5, 0 );
directive_failed( status, "rtems_task_start of TA5" );
status = rtems_task_delete( RTEMS_SELF );
directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
}

View File

@@ -1,468 +0,0 @@
*** MALLOC TEST ***
TA1 - rtems_clock_get - 09:00:00 12/31/1988
mallocing 513 bytes
TA2 - rtems_clock_get - 09:00:00 12/31/1988
mallocing 513 bytes
TA3 - rtems_clock_get - 09:00:00 12/31/1988
mallocing 513 bytes
TA4 - rtems_clock_get - 09:00:00 12/31/1988
mallocing 513 bytes
TA5 - rtems_clock_get - 09:00:00 12/31/1988
mallocing 513 bytes
TA1 - rtems_clock_get - 09:00:00 12/31/1988
mallocing 175 bytes
TA2 - rtems_clock_get - 09:00:00 12/31/1988
mallocing 175 bytes
TA1 - rtems_clock_get - 09:00:00 12/31/1988
mallocing 308 bytes
TA3 - rtems_clock_get - 09:00:00 12/31/1988
mallocing 175 bytes
TA1 - rtems_clock_get - 09:00:00 12/31/1988
mallocing 534 bytes
TA2 - rtems_clock_get - 09:00:01 12/31/1988
mallocing 308 bytes
TA4 - rtems_clock_get - 09:00:01 12/31/1988
mallocing 175 bytes
TA1 - rtems_clock_get - 09:00:01 12/31/1988
mallocing 947 bytes
TA5 - rtems_clock_get - 09:00:01 12/31/1988
mallocing 175 bytes
TA1 - rtems_clock_get - 09:00:01 12/31/1988
mallocing 171 bytes
TA2 - rtems_clock_get - 09:00:01 12/31/1988
mallocing 534 bytes
TA3 - rtems_clock_get - 09:00:01 12/31/1988
mallocing 308 bytes
TA1 - rtems_clock_get - 09:00:01 12/31/1988
mallocing 702 bytes
TA1 - rtems_clock_get - 09:00:01 12/31/1988
mallocing 226 bytes
TA2 - rtems_clock_get - 09:00:02 12/31/1988
mallocing 947 bytes
TA4 - rtems_clock_get - 09:00:02 12/31/1988
mallocing 308 bytes
TA1 - rtems_clock_get - 09:00:02 12/31/1988
mallocing 494 bytes
TA3 - rtems_clock_get - 09:00:02 12/31/1988
mallocing 534 bytes
TA1 - rtems_clock_get - 09:00:02 12/31/1988
mallocing 124 bytes
TA2 - rtems_clock_get - 09:00:02 12/31/1988
mallocing 171 bytes
TA5 - rtems_clock_get - 09:00:02 12/31/1988
mallocing 308 bytes
TA1 - rtems_clock_get - 09:00:02 12/31/1988
mallocing 83 bytes
TA1 - rtems_clock_get - 09:00:02 12/31/1988
mallocing 389 bytes
TA2 - rtems_clock_get - 09:00:03 12/31/1988
mallocing 702 bytes
TA4 - rtems_clock_get - 09:00:03 12/31/1988
mallocing 534 bytes
TA3 - rtems_clock_get - 09:00:03 12/31/1988
mallocing 947 bytes
TA1 - rtems_clock_get - 09:00:03 12/31/1988
mallocing 277 bytes
TA1 - rtems_clock_get - 09:00:03 12/31/1988
mallocing 368 bytes
TA2 - rtems_clock_get - 09:00:03 12/31/1988
mallocing 226 bytes
TA1 - rtems_clock_get - 09:00:03 12/31/1988
mallocing 983 bytes
TA5 - rtems_clock_get - 09:00:03 12/31/1988
mallocing 534 bytes
TA3 - rtems_clock_get - 09:00:03 12/31/1988
mallocing 171 bytes
TA1 - rtems_clock_get - 09:00:03 12/31/1988
mallocing 535 bytes
TA2 - rtems_clock_get - 09:00:04 12/31/1988
mallocing 494 bytes
TA4 - rtems_clock_get - 09:00:04 12/31/1988
mallocing 947 bytes
TA1 - rtems_clock_get - 09:00:04 12/31/1988
mallocing 765 bytes
TA1 - rtems_clock_get - 09:00:04 12/31/1988
mallocing 646 bytes
TA2 - rtems_clock_get - 09:00:04 12/31/1988
mallocing 124 bytes
TA3 - rtems_clock_get - 09:00:04 12/31/1988
mallocing 702 bytes
TA1 - rtems_clock_get - 09:00:04 12/31/1988
mallocing 767 bytes
TA1 - rtems_clock_get - 09:00:04 12/31/1988
mallocing 780 bytes
TA2 - rtems_clock_get - 09:00:05 12/31/1988
mallocing 83 bytes
TA4 - rtems_clock_get - 09:00:05 12/31/1988
mallocing 171 bytes
TA5 - rtems_clock_get - 09:00:05 12/31/1988
mallocing 947 bytes
TA1 - rtems_clock_get - 09:00:05 12/31/1988
mallocing 822 bytes
TA3 - rtems_clock_get - 09:00:05 12/31/1988
mallocing 226 bytes
TA1 - rtems_clock_get - 09:00:05 12/31/1988
mallocing 151 bytes
TA2 - rtems_clock_get - 09:00:05 12/31/1988
mallocing 389 bytes
TA1 - rtems_clock_get - 09:00:05 12/31/1988
mallocing 625 bytes
TA1 - rtems_clock_get - 09:00:05 12/31/1988
mallocing 314 bytes
TA2 - rtems_clock_get - 09:00:06 12/31/1988
mallocing 277 bytes
TA4 - rtems_clock_get - 09:00:06 12/31/1988
mallocing 702 bytes
TA3 - rtems_clock_get - 09:00:06 12/31/1988
mallocing 494 bytes
TA1 - rtems_clock_get - 09:00:06 12/31/1988
mallocing 346 bytes
TA5 - rtems_clock_get - 09:00:06 12/31/1988
mallocing 171 bytes
TA1 - rtems_clock_get - 09:00:06 12/31/1988
mallocing 917 bytes
TA2 - rtems_clock_get - 09:00:06 12/31/1988
mallocing 368 bytes
TA1 - rtems_clock_get - 09:00:06 12/31/1988
mallocing 519 bytes
TA3 - rtems_clock_get - 09:00:06 12/31/1988
mallocing 124 bytes
TA1 - rtems_clock_get - 09:00:06 12/31/1988
mallocing 401 bytes
TA2 - rtems_clock_get - 09:00:07 12/31/1988
mallocing 983 bytes
TA4 - rtems_clock_get - 09:00:07 12/31/1988
mallocing 226 bytes
TA1 - rtems_clock_get - 09:00:07 12/31/1988
mallocing 606 bytes
TA1 - rtems_clock_get - 09:00:07 12/31/1988
mallocing 785 bytes
TA2 - rtems_clock_get - 09:00:07 12/31/1988
mallocing 535 bytes
TA5 - rtems_clock_get - 09:00:07 12/31/1988
mallocing 702 bytes
TA3 - rtems_clock_get - 09:00:07 12/31/1988
mallocing 83 bytes
TA1 - rtems_clock_get - 09:00:07 12/31/1988
mallocing 931 bytes
TA1 - rtems_clock_get - 09:00:07 12/31/1988
mallocing 869 bytes
TA2 - rtems_clock_get - 09:00:08 12/31/1988
mallocing 765 bytes
TA4 - rtems_clock_get - 09:00:08 12/31/1988
mallocing 494 bytes
TA1 - rtems_clock_get - 09:00:08 12/31/1988
mallocing 866 bytes
TA3 - rtems_clock_get - 09:00:08 12/31/1988
mallocing 389 bytes
TA1 - rtems_clock_get - 09:00:08 12/31/1988
mallocing 674 bytes
TA2 - rtems_clock_get - 09:00:08 12/31/1988
mallocing 646 bytes
TA1 - rtems_clock_get - 09:00:08 12/31/1988
mallocing 758 bytes
TA5 - rtems_clock_get - 09:00:08 12/31/1988
mallocing 226 bytes
TA1 - rtems_clock_get - 09:00:08 12/31/1988
mallocing 581 bytes
TA2 - rtems_clock_get - 09:00:09 12/31/1988
mallocing 767 bytes
TA4 - rtems_clock_get - 09:00:09 12/31/1988
mallocing 124 bytes
TA3 - rtems_clock_get - 09:00:09 12/31/1988
mallocing 277 bytes
TA1 - rtems_clock_get - 09:00:09 12/31/1988
mallocing 389 bytes
TA1 - rtems_clock_get - 09:00:09 12/31/1988
mallocing 355 bytes
TA2 - rtems_clock_get - 09:00:09 12/31/1988
mallocing 780 bytes
TA1 - rtems_clock_get - 09:00:09 12/31/1988
mallocing 200 bytes
TA3 - rtems_clock_get - 09:00:09 12/31/1988
mallocing 368 bytes
TA1 - rtems_clock_get - 09:00:09 12/31/1988
mallocing 826 bytes
TA2 - rtems_clock_get - 09:00:10 12/31/1988
mallocing 822 bytes
TA4 - rtems_clock_get - 09:00:10 12/31/1988
mallocing 83 bytes
TA5 - rtems_clock_get - 09:00:10 12/31/1988
mallocing 494 bytes
TA1 - rtems_clock_get - 09:00:10 12/31/1988
mallocing 415 bytes
TA1 - rtems_clock_get - 09:00:10 12/31/1988
mallocing 463 bytes
TA2 - rtems_clock_get - 09:00:10 12/31/1988
mallocing 151 bytes
TA3 - rtems_clock_get - 09:00:10 12/31/1988
mallocing 983 bytes
TA1 - rtems_clock_get - 09:00:10 12/31/1988
mallocing 979 bytes
TA1 - rtems_clock_get - 09:00:10 12/31/1988
mallocing 126 bytes
TA2 - rtems_clock_get - 09:00:11 12/31/1988
mallocing 625 bytes
TA4 - rtems_clock_get - 09:00:11 12/31/1988
mallocing 389 bytes
TA1 - rtems_clock_get - 09:00:11 12/31/1988
mallocing 212 bytes
TA5 - rtems_clock_get - 09:00:11 12/31/1988
mallocing 124 bytes
TA3 - rtems_clock_get - 09:00:11 12/31/1988
mallocing 535 bytes
TA1 - rtems_clock_get - 09:00:11 12/31/1988
mallocing 958 bytes
TA2 - rtems_clock_get - 09:00:11 12/31/1988
mallocing 314 bytes
TA1 - rtems_clock_get - 09:00:11 12/31/1988
mallocing 737 bytes
TA1 - rtems_clock_get - 09:00:11 12/31/1988
mallocing 409 bytes
TA2 - rtems_clock_get - 09:00:12 12/31/1988
mallocing 346 bytes
TA4 - rtems_clock_get - 09:00:12 12/31/1988
mallocing 277 bytes
TA3 - rtems_clock_get - 09:00:12 12/31/1988
mallocing 765 bytes
TA1 - rtems_clock_get - 09:00:12 12/31/1988
mallocing 780 bytes
TA1 - rtems_clock_get - 09:00:12 12/31/1988
mallocing 757 bytes
TA2 - rtems_clock_get - 09:00:12 12/31/1988
mallocing 917 bytes
TA5 - rtems_clock_get - 09:00:12 12/31/1988
mallocing 83 bytes
TA1 - rtems_clock_get - 09:00:12 12/31/1988
mallocing 956 bytes
TA3 - rtems_clock_get - 09:00:12 12/31/1988
mallocing 646 bytes
TA1 - rtems_clock_get - 09:00:12 12/31/1988
mallocing 28 bytes
TA2 - rtems_clock_get - 09:00:13 12/31/1988
mallocing 519 bytes
TA4 - rtems_clock_get - 09:00:13 12/31/1988
mallocing 368 bytes
TA1 - rtems_clock_get - 09:00:13 12/31/1988
mallocing 318 bytes
TA1 - rtems_clock_get - 09:00:13 12/31/1988
mallocing 756 bytes
TA2 - rtems_clock_get - 09:00:13 12/31/1988
mallocing 401 bytes
TA3 - rtems_clock_get - 09:00:13 12/31/1988
mallocing 767 bytes
TA1 - rtems_clock_get - 09:00:13 12/31/1988
mallocing 242 bytes
TA5 - rtems_clock_get - 09:00:13 12/31/1988
mallocing 389 bytes
TA1 - rtems_clock_get - 09:00:13 12/31/1988
mallocing 589 bytes
TA2 - rtems_clock_get - 09:00:14 12/31/1988
mallocing 606 bytes
TA4 - rtems_clock_get - 09:00:14 12/31/1988
mallocing 983 bytes
TA1 - rtems_clock_get - 09:00:14 12/31/1988
mallocing 43 bytes
TA3 - rtems_clock_get - 09:00:14 12/31/1988
mallocing 780 bytes
TA1 - rtems_clock_get - 09:00:14 12/31/1988
mallocing 956 bytes
TA2 - rtems_clock_get - 09:00:14 12/31/1988
mallocing 785 bytes
TA1 - rtems_clock_get - 09:00:14 12/31/1988
mallocing 319 bytes
TA1 - rtems_clock_get - 09:00:14 12/31/1988
mallocing 59 bytes
TA2 - rtems_clock_get - 09:00:15 12/31/1988
mallocing 931 bytes
TA4 - rtems_clock_get - 09:00:15 12/31/1988
mallocing 535 bytes
TA5 - rtems_clock_get - 09:00:15 12/31/1988
mallocing 277 bytes
TA3 - rtems_clock_get - 09:00:15 12/31/1988
mallocing 822 bytes
TA1 - rtems_clock_get - 09:00:15 12/31/1988
mallocing 441 bytes
TA1 - rtems_clock_get - 09:00:15 12/31/1988
mallocing 915 bytes
TA2 - rtems_clock_get - 09:00:15 12/31/1988
mallocing 869 bytes
TA1 - rtems_clock_get - 09:00:15 12/31/1988
mallocing 572 bytes
TA3 - rtems_clock_get - 09:00:15 12/31/1988
mallocing 151 bytes
TA1 - rtems_clock_get - 09:00:15 12/31/1988
mallocing 118 bytes
TA2 - rtems_clock_get - 09:00:16 12/31/1988
mallocing 866 bytes
TA4 - rtems_clock_get - 09:00:16 12/31/1988
mallocing 765 bytes
TA1 - rtems_clock_get - 09:00:16 12/31/1988
mallocing 569 bytes
TA5 - rtems_clock_get - 09:00:16 12/31/1988
mallocing 368 bytes
TA1 - rtems_clock_get - 09:00:16 12/31/1988
mallocing 252 bytes
TA2 - rtems_clock_get - 09:00:16 12/31/1988
mallocing 674 bytes
TA3 - rtems_clock_get - 09:00:16 12/31/1988
mallocing 625 bytes
TA1 - rtems_clock_get - 09:00:16 12/31/1988
mallocing 495 bytes
TA1 - rtems_clock_get - 09:00:16 12/31/1988
mallocing 236 bytes
TA2 - rtems_clock_get - 09:00:17 12/31/1988
mallocing 758 bytes
TA4 - rtems_clock_get - 09:00:17 12/31/1988
mallocing 646 bytes
TA1 - rtems_clock_get - 09:00:17 12/31/1988
mallocing 476 bytes
TA3 - rtems_clock_get - 09:00:17 12/31/1988
mallocing 314 bytes
TA1 - rtems_clock_get - 09:00:17 12/31/1988
mallocing 406 bytes
TA2 - rtems_clock_get - 09:00:17 12/31/1988
mallocing 581 bytes
TA5 - rtems_clock_get - 09:00:17 12/31/1988
mallocing 983 bytes
TA1 - rtems_clock_get - 09:00:17 12/31/1988
mallocing 872 bytes
TA1 - rtems_clock_get - 09:00:17 12/31/1988
mallocing 426 bytes
TA2 - rtems_clock_get - 09:00:18 12/31/1988
mallocing 389 bytes
TA4 - rtems_clock_get - 09:00:18 12/31/1988
mallocing 767 bytes
TA3 - rtems_clock_get - 09:00:18 12/31/1988
mallocing 346 bytes
TA1 - rtems_clock_get - 09:00:18 12/31/1988
mallocing 358 bytes
TA1 - rtems_clock_get - 09:00:18 12/31/1988
mallocing 381 bytes
TA2 - rtems_clock_get - 09:00:18 12/31/1988
mallocing 355 bytes
TA1 - rtems_clock_get - 09:00:18 12/31/1988
mallocing 43 bytes
TA5 - rtems_clock_get - 09:00:18 12/31/1988
mallocing 535 bytes
TA3 - rtems_clock_get - 09:00:18 12/31/1988
mallocing 917 bytes
TA1 - rtems_clock_get - 09:00:18 12/31/1988
mallocing 160 bytes
TA2 - rtems_clock_get - 09:00:19 12/31/1988
mallocing 200 bytes
TA4 - rtems_clock_get - 09:00:19 12/31/1988
mallocing 780 bytes
TA1 - rtems_clock_get - 09:00:19 12/31/1988
mallocing 522 bytes
TA1 - rtems_clock_get - 09:00:19 12/31/1988
mallocing 696 bytes
TA2 - rtems_clock_get - 09:00:19 12/31/1988
mallocing 826 bytes
TA3 - rtems_clock_get - 09:00:19 12/31/1988
mallocing 519 bytes
TA1 - rtems_clock_get - 09:00:19 12/31/1988
mallocing 97 bytes
TA1 - rtems_clock_get - 09:00:19 12/31/1988
mallocing 400 bytes
TA2 - rtems_clock_get - 09:00:20 12/31/1988
mallocing 415 bytes
TA4 - rtems_clock_get - 09:00:20 12/31/1988
mallocing 822 bytes
TA5 - rtems_clock_get - 09:00:20 12/31/1988
mallocing 765 bytes
TA1 - rtems_clock_get - 09:00:20 12/31/1988
mallocing 773 bytes
TA3 - rtems_clock_get - 09:00:20 12/31/1988
mallocing 401 bytes
TA1 - rtems_clock_get - 09:00:20 12/31/1988
mallocing 244 bytes
TA2 - rtems_clock_get - 09:00:20 12/31/1988
mallocing 463 bytes
TA1 - rtems_clock_get - 09:00:20 12/31/1988
mallocing 342 bytes
TA1 - rtems_clock_get - 09:00:20 12/31/1988
mallocing 229 bytes
TA2 - rtems_clock_get - 09:00:21 12/31/1988
mallocing 979 bytes
TA4 - rtems_clock_get - 09:00:21 12/31/1988
mallocing 151 bytes
TA3 - rtems_clock_get - 09:00:21 12/31/1988
mallocing 606 bytes
TA1 - rtems_clock_get - 09:00:21 12/31/1988
mallocing 297 bytes
TA5 - rtems_clock_get - 09:00:21 12/31/1988
mallocing 646 bytes
TA1 - rtems_clock_get - 09:00:21 12/31/1988
mallocing 304 bytes
TA2 - rtems_clock_get - 09:00:21 12/31/1988
mallocing 126 bytes
TA1 - rtems_clock_get - 09:00:21 12/31/1988
mallocing 887 bytes
TA3 - rtems_clock_get - 09:00:21 12/31/1988
mallocing 785 bytes
TA1 - rtems_clock_get - 09:00:21 12/31/1988
mallocing 36 bytes
TA2 - rtems_clock_get - 09:00:22 12/31/1988
mallocing 212 bytes
TA4 - rtems_clock_get - 09:00:22 12/31/1988
mallocing 625 bytes
TA1 - rtems_clock_get - 09:00:22 12/31/1988
mallocing 651 bytes
TA1 - rtems_clock_get - 09:00:22 12/31/1988
mallocing 398 bytes
TA2 - rtems_clock_get - 09:00:22 12/31/1988
mallocing 958 bytes
TA5 - rtems_clock_get - 09:00:22 12/31/1988
mallocing 767 bytes
TA3 - rtems_clock_get - 09:00:22 12/31/1988
mallocing 931 bytes
TA1 - rtems_clock_get - 09:00:22 12/31/1988
mallocing 676 bytes
TA1 - rtems_clock_get - 09:00:22 12/31/1988
mallocing 732 bytes
TA2 - rtems_clock_get - 09:00:23 12/31/1988
mallocing 737 bytes
TA4 - rtems_clock_get - 09:00:23 12/31/1988
mallocing 314 bytes
TA1 - rtems_clock_get - 09:00:23 12/31/1988
mallocing 937 bytes
TA3 - rtems_clock_get - 09:00:23 12/31/1988
mallocing 869 bytes
TA1 - rtems_clock_get - 09:00:23 12/31/1988
mallocing 233 bytes
TA2 - rtems_clock_get - 09:00:23 12/31/1988
mallocing 409 bytes
TA1 - rtems_clock_get - 09:00:23 12/31/1988
mallocing 838 bytes
TA5 - rtems_clock_get - 09:00:23 12/31/1988
mallocing 780 bytes
TA1 - rtems_clock_get - 09:00:23 12/31/1988
mallocing 967 bytes
TA2 - rtems_clock_get - 09:00:24 12/31/1988
mallocing 780 bytes
TA4 - rtems_clock_get - 09:00:24 12/31/1988
mallocing 346 bytes
TA3 - rtems_clock_get - 09:00:24 12/31/1988
mallocing 866 bytes
TA1 - rtems_clock_get - 09:00:24 12/31/1988
mallocing 778 bytes
TA1 - rtems_clock_get - 09:00:24 12/31/1988
mallocing 431 bytes
TA2 - rtems_clock_get - 09:00:24 12/31/1988
mallocing 757 bytes
TA1 - rtems_clock_get - 09:00:24 12/31/1988
mallocing 674 bytes
TA3 - rtems_clock_get - 09:00:24 12/31/1988
mallocing 674 bytes
TA1 - rtems_clock_get - 09:00:24 12/31/1988
mallocing 809 bytes
TA2 - rtems_clock_get - 09:00:25 12/31/1988
mallocing 956 bytes
TA4 - rtems_clock_get - 09:00:25 12/31/1988
mallocing 917 bytes
TA5 - rtems_clock_get - 09:00:25 12/31/1988
mallocing 822 bytes
TA1 - rtems_clock_get - 09:00:25 12/31/1988
mallocing 158 bytes
*** END OF MALLOC TEST ***

View File

@@ -1,51 +0,0 @@
/* system.h
*
* This include file contains information that is included in every
* function in the test set.
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#include <tmacros.h>
/* macros */
/* functions */
rtems_task Init(
rtems_task_argument argument
);
rtems_task Task_1_through_5(
rtems_task_argument argument
);
void blow_stack( void );
/* configuration information */
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define TASK_STACK_SIZE (RTEMS_MINIMUM_STACK_SIZE*3)
#define CONFIGURE_EXTRA_TASK_STACKS ((RTEMS_MINIMUM_STACK_SIZE*2)*5)
#define CONFIGURE_MAXIMUM_TASKS 6
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#include <confdefs.h>
/* global variables */
TEST_EXTERN rtems_id Task_id[ 6 ]; /* array of task ids */
TEST_EXTERN rtems_name Task_name[ 6 ]; /* array of task names */
/* end of include file */

View File

@@ -1,72 +0,0 @@
/* task1.c
*
* This set of three tasks do some simple task switching for about
* 15 seconds and then call a routine to "blow the stack".
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#include "system.h"
#include <rtems/libcsupport.h> /* for malloc_dump, malloc_walk */
#include <string.h> /* for memset */
#include <stdlib.h>
#define NUM_PASSES 100
rtems_task Task_1_through_5(
rtems_task_argument argument
)
{
int i;
unsigned int passes = 0;
rtems_id tid;
rtems_time_of_day time;
rtems_status_code status;
unsigned char *mem_ptr;
int mem_amt;
status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
directive_failed( status, "rtems_task_ident" );
while (TRUE)
{
if ( passes++ > NUM_PASSES ) {
puts("*** END OF MALLOC TEST ***");
rtems_test_exit(0);
}
status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
directive_failed( status, "rtems_clock_get" );
put_name( Task_name[ task_number( tid ) ], FALSE );
print_time( " - rtems_clock_get - ", &time, "\n" );
mem_amt = ((int)((float)rand()*1000.0/(float)RAND_MAX));
while (!(mem_ptr = malloc ( mem_amt))) {
printf("out of memory... trying again.\n");
mem_amt = ((int)((float)rand()*1000.0/(float)RAND_MAX));
}
printf("mallocing %d bytes\n",mem_amt);
memset( mem_ptr, mem_amt, mem_amt );
malloc_dump();
malloc_walk(1,FALSE);
status = rtems_task_wake_after( task_number( tid ) * 1 * TICKS_PER_SECOND/4 );
for (i=0; i < mem_amt; i++)
{
if ( mem_ptr[i] != (mem_amt & 0xff))
{
printf("failed %d, %d, 0x%x, 0x%x\n",i,mem_amt,mem_ptr[i],mem_amt&0xff);
rtems_test_exit(1);
}
}
directive_failed( status, "rtems_task_wake_after" );
free( mem_ptr );
}
}

View File

@@ -1,2 +0,0 @@
Makefile
Makefile.in

View File

@@ -1,43 +0,0 @@
##
## $Id$
##
TEST = monitor
MANAGERS = dpmem event io msg mp part region sem signal timer rate_monotonic \
ext
C_FILES = init.c
C_O_FILES = $(C_FILES:%.c=${ARCH}/%.$(OBJEXT))
H_FILES = system.h
noinst_HEADERS = $(H_FILES)
DOCTYPES = scn
DOCS = #$(DOCTYPES:%=$(TEST).%)
SRCS = $(DOCS) $(C_FILES) $(H_FILES)
OBJS = $(C_O_FILES)
PRINT_SRCS = $(DOCS)
PGM = ${ARCH}/$(TEST).exe
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../automake/compile.am
include $(top_srcdir)/../automake/leaf.am
include $(top_srcdir)/libtests.am
#
# (OPTIONAL) Add local stuff here using +=
#
${PGM}: $(OBJS) $(LINK_FILES)
$(make-exe)
all-local: $(ARCH) $(TMPINSTALL_FILES)
EXTRA_DIST = $(C_FILES) $(DOCS)
include $(top_srcdir)/../automake/local.am

View File

@@ -1,73 +0,0 @@
/*
* This is a simple test whose only purpose is to start the Monitor
* task. The Monitor task can be used to obtain information about
* a variety of RTEMS objects.
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#define TEST_INIT
#include "system.h"
#include <rtems/monitor.h>
rtems_task_priority Priorities[6] = { 0, 1, 1, 3, 4, 5 };
rtems_task Task_1_through_5(
rtems_unsigned32 argument
)
{
rtems_status_code status;
for ( ; ; ) {
status = rtems_task_wake_after( 100 );
directive_failed( status, "rtems_task_wake_after" );
}
}
rtems_task Init(
rtems_task_argument argument
)
{
rtems_unsigned32 index;
rtems_status_code status;
puts( "\n\n*** MONITOR TASK TEST ***" );
Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' );
Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' );
for ( index = 1 ; index <= 5 ; index++ ) {
status = rtems_task_create(
Task_name[ index ],
Priorities[ index ],
RTEMS_MINIMUM_STACK_SIZE * 4,
RTEMS_DEFAULT_MODES,
(index == 5) ? RTEMS_FLOATING_POINT : RTEMS_DEFAULT_ATTRIBUTES,
&Task_id[ index ]
);
directive_failed( status, "rtems_task_create loop" );
}
for ( index = 1 ; index <= 5 ; index++ ) {
status = rtems_task_start( Task_id[ index ], Task_1_through_5, index );
directive_failed( status, "rtems_task_start loop" );
}
rtems_monitor_init( 0 );
status = rtems_task_delete( RTEMS_SELF );
directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
}

View File

@@ -1,59 +0,0 @@
/* system.h
*
* This include file contains information that is included in every
* function in the test set.
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#include <tmacros.h>
/* types */
struct counters {
rtems_unsigned32 count[6];
};
/* functions */
rtems_task Init(
rtems_task_argument argument
);
rtems_task Task_1_through_5(
rtems_task_argument argument
);
void Get_all_counters( void );
/* configuration information */
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_MAXIMUM_TASKS 7
#define CONFIGURE_MAXIMUM_PERIODS 10
#define CONFIGURE_INIT_TASK_PRIORITY 10
#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_EXTRA_TASK_STACKS \
(6 * (3 * RTEMS_MINIMUM_STACK_SIZE)) /* our tasks */ + \
(1 * RTEMS_MINIMUM_STACK_SIZE) /* monitor tasks */
#include <confdefs.h>
/* global variables */
TEST_EXTERN rtems_id Task_id[ 6 ]; /* array of task ids */
TEST_EXTERN rtems_name Task_name[ 6 ]; /* array of task names */
/* end of include file */

View File

@@ -1,2 +0,0 @@
Makefile
Makefile.in

View File

@@ -1,42 +0,0 @@
##
## $Id$
##
TEST = putenvtest
MANAGERS = io
C_FILES = init.c
C_O_FILES = $(C_FILES:%.c=${ARCH}/%.$(OBJEXT))
H_FILES =
noinst_HEADERS = $(H_FILES)
DOCTYPES =
DOCS = $(DOCTYPES:%=$(TEST).%)
SRCS = $(DOCS) $(C_FILES) $(CC_FILES) $(H_FILES) $(S_FILES)
OBJS = $(C_O_FILES) $(CC_O_FILES) $(S_O_FILES)
PRINT_SRCS = $(DOCS)
PGM = ${ARCH}/$(TEST).exe
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../automake/compile.am
include $(top_srcdir)/../automake/leaf.am
include $(top_srcdir)/libtests.am
#
# (OPTIONAL) Add local stuff here using +=
#
${PGM}: $(OBJS) $(LINK_FILES)
$(make-exe)
all-local: $(ARCH) $(TMPINSTALL_FILES)
EXTRA_DIST = $(C_FILES) $(DOCS)
include $(top_srcdir)/../automake/local.am

View File

@@ -1,61 +0,0 @@
/* Init
*
* This routine is the initialization task for this test program.
* It is a user initialization task and has the responsibility for creating
* and starting the tasks that make up the test. If the time of day
* clock is required for the test, it should also be set to a known
* value by this function.
*
* Input parameters:
* argument - task argument
*
* Output parameters: NONE
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#define TEST_INIT
#include <tmacros.h>
#include <stdio.h>
#include <stdlib.h>
/* putenv is beyond ANSI so prototype it here */
int putenv(const char *string);
rtems_task Init(
rtems_task_argument argument
);
/* configuration information */
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define TASK_STACK_SIZE (RTEMS_MINIMUM_STACK_SIZE*3)
#define CONFIGURE_MAXIMUM_TASKS 1
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#include <confdefs.h>
rtems_task Init(
rtems_task_argument argument
)
{
puts( "\n\n*** PUTENV/GETENV TEST ***" );
puts( "putenv(\"FOO=BAR\") - expected to work" );
putenv ("FOO=BAR");
printf ("getenv(\"FOO\") ==> \"%s\"\n", getenv ("FOO"));
puts( "*** END OF PUTENV/GETENV TEST ***" );
rtems_test_exit(0);
}

View File

@@ -1,2 +0,0 @@
Makefile
Makefile.in

View File

@@ -1,62 +0,0 @@
/* Init
*
* This routine is the initialization task for this test program.
*
* Input parameters:
* argument - task argument
*
* Output parameters: NONE
*
* COPYRIGHT (c) 1997
* Objective Design Systems Ltd Pty (ODS)
* All rights reserved (R) Objective Design Systems Ltd Pty
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#define TEST_INIT
#include "System.h"
// make global so it lasts past the Init task's stack's life time
Task1 task_1;
rtems_task Init(rtems_task_argument )
{
puts( "\n\n*** RTEMS++ TEST ***" );
printf( "INIT - Task.create() - " );
task_1.create("TA1 ", 0, RTEMS_MINIMUM_STACK_SIZE);
printf("%s\n", task_1.last_status_string());
printf( "INIT - Task.create() - " );
task_1.create("TA1 ", 10, RTEMS_MINIMUM_STACK_SIZE * 6);
printf("%s\n", task_1.last_status_string());
printf( "INIT - Task.create() - " );
task_1.create("TA1 ", 10, RTEMS_MINIMUM_STACK_SIZE * 6);
printf("%s\n", task_1.last_status_string());
printf( "INIT - Task.restart() - " );
task_1.restart(0);
printf("%s\n", task_1.last_status_string());
printf( "INIT - Task.start(0xDEADDEAD) - " );
task_1.start(0xDEADDEAD);
printf("%s\n", task_1.last_status_string());
printf("INIT - Destroy it's self\n");
// needs to be in C, no C++ object owns the Init task
rtems_status_code status = rtems_task_delete( RTEMS_SELF );
directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
}

View File

@@ -1,48 +0,0 @@
##
## $Id$
##
TEST = rtems++
MANAGERS = event io msg sem signal timer rate_monotonic
CC_FILES = Init.cc Task1.cc Task2.cc Task3.cc
OBJS = $(CC_FILES:%.cc=${ARCH}/%.$(OBJEXT))
H_FILES = System.h
noinst_HEADERS = $(H_FILES)
DOCTYPES = scn doc
DOCS = $(DOCTYPES:%=$(TEST).%)
SRCS = $(DOCS) $(C_FILES) $(H_FILES)
PRINT_SRCS = $(DOCS)
PGM = ${ARCH}/$(TEST).exe
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../automake/compile.am
include $(top_srcdir)/../automake/leaf.am
include $(top_srcdir)/libtests.am
#
# (OPTIONAL) Add local stuff here using +=
#
LD_LIBS = -lrtems++$(LIB_VARIANT)
if HAS_CXX
${PGM}: $(OBJS) $(LINK_FILES)
$(make-cxx-exe)
all-local: $(ARCH) $(TMPINSTALL_FILES)
else
all-local:
endif
EXTRA_DIST = $(CC_FILES) $(DOCS)
include $(top_srcdir)/../automake/local.am

View File

@@ -1,135 +0,0 @@
/* system.h
*
* This include file contains information that is included in every
* function in the test set.
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#include <tmacros.h>
#include <rtems++/rtemsEvent.h>
#include <rtems++/rtemsMessageQueue.h>
#include <rtems++/rtemsTask.h>
#include <rtems++/rtemsTaskMode.h>
/* functions */
extern "C"
{
rtems_task Init(
rtems_task_argument argument
);
}
rtems_timer_service_routine Delayed_routine(
rtems_id ignored_id,
void *ignored_address
);
class Task1
: public rtemsTask
{
void print_mode(rtems_mode mode, rtems_mode mask);
void screen1(void);
void screen2(void);
void screen3(void);
void screen4(void);
void screen5(void);
void screen6(void);
protected:
virtual void body(rtems_task_argument argument);
public:
};
class Task2
: public rtemsTask
{
void screen4(void);
protected:
virtual void body(rtems_task_argument argument);
public:
Task2(const char* name,
const rtems_task_priority initial_priority,
const rtems_unsigned32 stack_size);
};
class Task3
: public rtemsTask
{
void screen6(void);
protected:
virtual void body(rtems_task_argument argument);
public:
Task3(const char* name,
const rtems_task_priority initial_priority,
const rtems_unsigned32 stack_size);
};
class EndTask
: public rtemsTask
{
protected:
virtual void body(rtems_task_argument argument);
public:
EndTask(const char* name,
const rtems_task_priority initial_priority,
const rtems_unsigned32 stack_size);
};
#if 0
//
// Not sure this can be tested in a generic manner, any ideas anyone !!
//
class Service_routine
: public rtemsInterrupt
{
};
class Io_during_interrupt
: pubic rtemsTimer
{
};
#endif
/* configuration information */
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_MAXIMUM_TASKS 8
#define CONFIGURE_MAXIMUM_TIMERS 1
#define CONFIGURE_MAXIMUM_SEMAPHORES 2
#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
#define CONFIGURE_MAXIMUM_PARTITIONS 1
#define CONFIGURE_MAXIMUM_REGIONS 1
#define CONFIGURE_MAXIMUM_PERIODS 1
#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 0
#define CONFIGURE_TICKS_PER_TIMESLICE 100
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_INIT_TASK_STACK_SIZE (4 * RTEMS_MINIMUM_STACK_SIZE)
#define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE)
#include <confdefs.h>
/* end of include file */

View File

@@ -1,681 +0,0 @@
/* Task1
*
* This task is the main line for the test. It creates other
* tasks which can create
*
* Input parameters:
* argument - task argument
*
* Output parameters: NONE
*
* COPYRIGHT (c) 1997
* Objective Design Systems Ltd Pty (ODS)
* All rights reserved (R) Objective Design Systems Ltd Pty
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#include <stdlib.h>
#include <string.h>
#include "System.h"
void Task1::body(rtems_task_argument argument)
{
rtems_test_pause_and_screen_number(1);
printf(" * START Task Class test *\n");
printf("%s - test argument - ", name_string());
if (argument != 0xDEADDEAD)
printf("argument is not 0xDEADDEAD\n");
else
printf("argument matched\n");
screen1();
rtems_test_pause_and_screen_number(2);
screen2();
rtems_test_pause_and_screen_number(3);
screen3();
rtems_test_pause_and_screen_number(4);
screen4();
rtems_test_pause_and_screen_number(5);
screen5();
rtems_test_pause_and_screen_number(6);
screen6();
// do not call exit(0) from this thread as this object is static
// the static destructor call delete the task which is calling exit
// so exit never completes
EndTask end_task("ENDT", (rtems_task_priority) 1, RTEMS_MINIMUM_STACK_SIZE * 6);
end_task.start(0);
rtemsEvent block_me;
rtems_event_set out;
block_me.receive(RTEMS_SIGNAL_0, out);
printf("**** TASK 1 did not block ????\n");
}
void Task1::screen1(void)
{
// create two local task objects to connect to this task
rtemsTask local_task_1 = *this;
rtemsTask local_task_2;
local_task_2 = *this;
// check the copy constructor works
printf("%s - copy constructor - ", name_string());
if (local_task_1.id_is() == id_is())
printf("local and this id's match\n");
else
printf("local and this id's do not match\n");
printf("%s - copy constructor - ", name_string());
if (local_task_1.name_is() == name_is())
printf("local and this name's match\n");
else
printf("local and this name's do not match\n");
// check the copy operator works
printf("%s - copy operator - ", name_string());
if (local_task_2.id_is() == id_is())
printf("local and this id's match\n");
else
printf("local and this id's do not match\n");
printf("%s - copy operator - ", name_string());
if (local_task_2.name_is() == name_is())
printf("local and this name's match\n");
else
printf("local and this name's do not match\n");
// check that the owner of the id cannot delete this task
printf("%s - not owner destroy's task - ", local_task_1.name_string());
local_task_1.destroy();
printf("%s\n", local_task_1.last_status_string());
// connect to a valid task
printf("%s - connect to a local valid task name - ", local_task_2.name_string());
local_task_2.connect("TA1 ", RTEMS_SEARCH_ALL_NODES);
printf("%s\n", local_task_2.last_status_string());
// connect to an invalid task
printf("%s - connect to an invalid task name - ", local_task_2.name_string());
local_task_2.connect("BADT", RTEMS_SEARCH_ALL_NODES);
printf("%s\n", local_task_2.last_status_string());
// connect to a task an invalid node
printf("%s - connect to a task on an invalid node - ", local_task_2.name_string());
local_task_2.connect("BADT", 10);
printf("%s\n", local_task_2.last_status_string());
// restart this task
printf("%s - restart from a non-owner - ", name_string());
local_task_1.restart(0);
printf("%s\n", local_task_1.last_status_string());
}
void Task1::screen2(void)
{
// wake after using this object
printf("%s - wake after 0 secs - ", name_string());
wake_after(0);
printf("%s\n", last_status_string());
printf("%s - wake after 500 msecs - ", name_string());
wake_after(500000);
printf("%s\n", last_status_string());
printf("%s - wake after 5 secs - ", name_string());
wake_after(5000000);
printf("%s\n", last_status_string());
printf("%s - wake when - to do\n", name_string());
rtemsTask task_1 = *this;
// wake after using a connected object
printf("%s - connected object wake after 0 secs - ", task_1.name_string());
task_1.wake_after(0);
printf("%s\n", task_1.last_status_string());
printf("%s - connected object wake after 500 msecs - ", task_1.name_string());
task_1.wake_after(500000);
printf("%s\n", task_1.last_status_string());
printf("%s - connected object wake after 5 secs - ", task_1.name_string());
task_1.wake_after(5000000);
printf("%s\n", task_1.last_status_string());
printf("%s - connected object wake when - to do\n", task_1.name_string());
rtemsTask task_2;
// wake after using a self object
printf("%s - self object wake after 0 secs - ", task_2.name_string());
task_2.wake_after(0);
printf("%s\n", task_2.last_status_string());
printf("%s - self object wake after 500 msecs - ", task_2.name_string());
task_2.wake_after(500000);
printf("%s\n", task_2.last_status_string());
printf("%s - self object wake after 5 secs - ", task_2.name_string());
task_2.wake_after(5000000);
printf("%s\n", task_2.last_status_string());
printf("%s - self object wake when - to do\n", task_2.name_string());
rtems_task_priority current_priority;
rtems_task_priority priority;
// priorities with this object
printf("%s - get priority - ", name_string());
get_priority(current_priority);
printf("%s, priority is %i\n", last_status_string(), current_priority);
printf("%s - set priority to 512 - ", name_string());
set_priority(512);
printf("%s\n", last_status_string());
printf("%s - set priority to 25 - ", name_string());
set_priority(25);
printf("%s\n", last_status_string());
printf("%s - set priority to original - ", name_string());
set_priority(current_priority, priority);
printf("%s, priority was %i\n", last_status_string(), priority);
// priorities with connected object
printf("%s - connected object get priority - ", task_1.name_string());
task_1.get_priority(current_priority);
printf("%s, priority is %i\n", task_1.last_status_string(), current_priority);
printf("%s - connected object set priority to 512 - ", task_1.name_string());
task_1.set_priority(512);
printf("%s\n", task_1.last_status_string());
printf("%s - connected object set priority to 25 - ", task_1.name_string());
task_1.set_priority(25);
printf("%s\n", task_1.last_status_string());
printf("%s - connected object set priority to original - ", task_1.name_string());
task_1.set_priority(current_priority, priority);
printf("%s, priority was %i\n", task_1.last_status_string(), priority);
// priorities with self object
printf("%s - self object get priority - ", task_2.name_string());
task_2.get_priority(current_priority);
printf("%s, priority is %i\n", task_2.last_status_string(), current_priority);
printf("%s - self object set priority to 512 - ", task_2.name_string());
task_2.set_priority(512);
printf("%s\n", task_2.last_status_string());
printf("%s - self object set priority to 25 - ", task_2.name_string());
task_2.set_priority(25);
printf("%s\n", task_2.last_status_string());
printf("%s - self object set priority to original - ", task_2.name_string());
task_2.set_priority(current_priority, priority);
printf("%s, priority was %i\n", task_2.last_status_string(), priority);
rtems_unsigned32 current_note;
rtems_unsigned32 note;
// notepad registers for this object
printf("%s - get note - ", name_string());
get_note(0, current_note);
printf("%s, note is %i\n", last_status_string(), current_note);
printf("%s - get with bad notepad number - ", name_string());
get_note(100, current_note);
printf("%s, note is %i\n", last_status_string(), current_note);
printf("%s - set note to 0xDEADBEEF - ", name_string());
set_note(0, 0xDEADBEEF);
printf("%s\n", last_status_string());
printf("%s - get note - ", name_string());
get_note(0, note);
printf("%s, note is 0x%08X\n", last_status_string(), note);
printf("%s - set note to original value - ", name_string());
set_note(0, current_note);
printf("%s\n", last_status_string());
// notepad registers for connected object
printf("%s - connected object get note - ", task_1.name_string());
task_1.get_note(0, current_note);
printf("%s, notepad is %i\n", task_1.last_status_string(), current_note);
printf("%s - connected object get with bad notepad number - ", task_1.name_string());
task_1.get_note(100, current_note);
printf("%s, note is %i\n", task_1.last_status_string(), current_note);
printf("%s - connected object set note to 0xDEADBEEF - ", task_1.name_string());
task_1.set_note(0, 0xDEADBEEF);
printf("%s\n", task_1.last_status_string());
printf("%s - connected object get note - ", task_1.name_string());
task_1.get_note(0, note);
printf("%s, note is 0x%08X\n", task_1.last_status_string(), note);
printf("%s - connected object set note to original value - ", task_1.name_string());
task_1.set_note(0, current_note);
printf("%s\n", task_1.last_status_string());
// notepad registers for self object
printf("%s - self object get note - ", task_2.name_string());
task_2.get_note(0, current_note);
printf("%s, note is %i\n", task_2.last_status_string(), current_note);
printf("%s - self object get with bad notepad number - ", task_2.name_string());
task_2.get_note(100, current_note);
printf("%s, note is %i\n", task_2.last_status_string(), current_note);
printf("%s - self object set note to 0xDEADBEEF - ", task_2.name_string());
task_2.set_note(0, 0xDEADBEEF);
printf("%s\n", task_2.last_status_string());
printf("%s - self object get note - ", task_2.name_string());
task_2.get_note(0, note);
printf("%s, notepad is 0x%08X\n", task_2.last_status_string(), note);
printf("%s - self object set note to original value - ", task_2.name_string());
task_2.set_note(0, current_note);
printf("%s\n", task_2.last_status_string());
printf(" * END Task Class test *\n");
}
#define RTEMS_ALL_MODES (RTEMS_PREEMPT_MASK | \
RTEMS_TIMESLICE_MASK | \
RTEMS_ASR_MASK | \
RTEMS_INTERRUPT_MASK)
void Task1::screen3(void)
{
printf(" * START TaskMode Class test *\n");
rtemsTask self;
rtemsTaskMode task_mode;
rtems_mode current_mode;
rtems_mode mode;
printf("%s - get mode - ", self.name_string());
task_mode.get_mode(current_mode);
printf("%s,\n\t mode is 0x%08X, ", task_mode.last_status_string(), current_mode);
print_mode(current_mode, RTEMS_ALL_MODES);
printf("\n");
// PREEMPTION mode control
printf("%s - get preemption state - ", self.name_string());
task_mode.get_preemption_state(mode);
printf("%s,\n\t mode is 0x%08X, ", task_mode.last_status_string(), mode);
print_mode(mode, RTEMS_PREEMPT_MASK);
printf("\n");
printf("%s - set preemption state to RTEMS_PREEMPT - ", self.name_string());
task_mode.set_preemption_state(RTEMS_PREEMPT);
task_mode.get_mode(mode);
printf("%s,\n\t mode is 0x%08X, ", task_mode.last_status_string(), mode);
print_mode(mode, RTEMS_ALL_MODES);
printf("\n");
printf("%s - set preemption state to RTEMS_NO_PREEMPT - ", self.name_string());
task_mode.set_preemption_state(RTEMS_NO_PREEMPT);
task_mode.get_mode(mode);
printf("%s,\n\t mode is 0x%08X, ", task_mode.last_status_string(), mode);
print_mode(mode, RTEMS_ALL_MODES);
printf("\n");
// TIMESLICE mode control
printf("%s - get timeslice state - ", self.name_string());
task_mode.get_timeslice_state(mode);
printf("%s,\n\t mode is 0x%08X, ", task_mode.last_status_string(), mode);
print_mode(mode, RTEMS_TIMESLICE_MASK);
printf("\n");
printf("%s - set timeslice state to RTEMS_TIMESLICE - ", self.name_string());
task_mode.set_timeslice_state(RTEMS_TIMESLICE);
task_mode.get_mode(mode);
printf("%s,\n\t mode is 0x%08X, ", task_mode.last_status_string(), mode);
print_mode(mode, RTEMS_ALL_MODES);
printf("\n");
printf("%s - set timeslice state to RTEMS_NO_TIMESLICE - ", self.name_string());
task_mode.set_timeslice_state(RTEMS_NO_TIMESLICE);
task_mode.get_mode(mode);
printf("%s,\n\t mode is 0x%08X, ", task_mode.last_status_string(), mode);
print_mode(mode, RTEMS_ALL_MODES);
printf("\n");
// ASR mode control
printf("%s - get asr state - ", self.name_string());
task_mode.get_asr_state(mode);
printf("%s,\n\t mode is 0x%08X, ", task_mode.last_status_string(), mode);
print_mode(mode, RTEMS_ASR_MASK);
printf("\n");
printf("%s - set asr state to RTEMS_ASR - ", self.name_string());
task_mode.set_asr_state(RTEMS_ASR);
task_mode.get_mode(mode);
printf("%s,\n\t mode is 0x%08X, ", task_mode.last_status_string(), mode);
print_mode(mode, RTEMS_ALL_MODES);
printf("\n");
printf("%s - set asr state to RTEMS_NO_ASR - ", self.name_string());
task_mode.set_asr_state(RTEMS_NO_ASR);
task_mode.get_mode(mode);
printf("%s,\n\t mode is 0x%08X, ", task_mode.last_status_string(), mode);
print_mode(mode, RTEMS_ALL_MODES);
printf("\n");
// interrupt level control
rtems_interrupt_level current_level;
rtems_interrupt_level level;
printf("%s - get current interrupt level - ", self.name_string());
task_mode.get_interrupt_level(current_level);
printf("%s, level is %i\n", task_mode.last_status_string(), current_level);
printf("%s - set interrupt level to 102 - ", self.name_string());
task_mode.set_interrupt_level(102);
printf("%s\n", task_mode.last_status_string());
printf("%s - set interrupt level to original level - ", self.name_string());
task_mode.set_interrupt_level(current_level, level);
printf("%s, level was %i\n", task_mode.last_status_string(), level);
printf("%s - set mode to original mode - ", self.name_string());
task_mode.set_mode(current_mode,
RTEMS_PREEMPT_MASK | RTEMS_TIMESLICE_MASK |
RTEMS_ASR_MASK | RTEMS_INTERRUPT_MASK);
task_mode.get_mode(mode);
printf("%s,\n\t mode is 0x%08X, ", task_mode.last_status_string(), mode);
print_mode(mode, RTEMS_ALL_MODES);
printf("\n");
printf(" * END TaskMode Class test *\n");
}
void Task1::screen4(void)
{
printf(" * START Event Class test *\n");
printf("%s - create task 2 - ", name_string());
Task2 task_2("TA2", (rtems_task_priority) 9, RTEMS_MINIMUM_STACK_SIZE * 6);
printf("%s\n", task_2.last_status_string());
printf("%s - start task 2 - ", name_string());
task_2.start(0);
printf("%s\n", task_2.last_status_string());
printf("%s - construct event connecting to task 2 - ", name_string());
rtemsEvent event_2("TA2 ");
printf("%s\n", event_2.last_status_string());
// wait for task 2 to complete its timeout tests
wake_after(7000000);
printf("%s - send event signal 0 using the task id - ", name_string());
event_2.send(task_2.id_is(), RTEMS_SIGNAL_0);
printf("%s\n", event_2.last_status_string());
wake_after(1000000);
printf("%s - send event signal 0 using the task object reference - ", name_string());
event_2.send(task_2, RTEMS_SIGNAL_0);
printf("%s\n", event_2.last_status_string());
wake_after(1000000);
printf("%s - send event signal 31 using connected id - ", name_string());
event_2.send(RTEMS_SIGNAL_31);
printf("%s\n", event_2.last_status_string());
wake_after(1000000);
rtemsEvent event_2_2;
event_2_2.connect("TA2");
printf("%s - send event signal 0 and 31 - ", name_string());
event_2_2.send(task_2, RTEMS_SIGNAL_0 | RTEMS_SIGNAL_31);
printf("%s\n", event_2_2.last_status_string());
printf("%s - waiting 5 secs for TA2 to finish\n", name_string());
wake_after(500000);
printf(" * END Event Class test *\n");
}
void Task1::screen5(void)
{
printf(" * START Interrupt Class test *\n");
printf(" do not know a portable BSP type interrupt test\n");
printf(" * END Interrupt Class test *\n");
}
void Task1::screen6(void)
{
printf(" * START MessageQueue Class test *\n");
printf("%s - construct message queue 1 with no memory error - ", name_string());
rtemsMessageQueue mq_1("MQ1", 1000000, 1000);
printf("%s\n", mq_1.last_status_string());
printf("%s - construct/create message queue 2 - ", name_string());
rtemsMessageQueue mq_2("MQ2", 4, 50);
printf("%s\n", mq_2.last_status_string());
char *u1 = "normal send";
char *u2 = "urgent send";
char in[100];
rtems_unsigned32 size;
printf("%s - send u1 to mq_2 - ", name_string());
mq_2.send(u1, strlen(u1) + 1);
printf("%s\n", mq_2.last_status_string());
printf("%s - urgent send u2 to mq_2 - ", name_string());
mq_2.urgent(u2, strlen(u2) + 1);
printf("%s\n", mq_2.last_status_string());
printf("%s - create task 3_1 - ", name_string());
Task3 task_3_1("TA31", 9, RTEMS_MINIMUM_STACK_SIZE * 6);
printf("%s\n", task_3_1.last_status_string());
printf("%s - start task 3_1 - ", name_string());
task_3_1.start(0);
printf("%s\n", task_3_1.last_status_string());
printf("%s - create task 3_2 - ", name_string());
Task3 task_3_2("TA32", 9, RTEMS_MINIMUM_STACK_SIZE * 6);
printf("%s\n", task_3_2.last_status_string());
printf("%s - start task 3_2 - ", name_string());
task_3_2.start(0);
printf("%s\n", task_3_1.last_status_string());
wake_after(1000000);
printf("%s - receive u2 on mq_2 ...\n", name_string()); fflush(stdout);
mq_2.receive(in, size, 5000000);
printf("%s - %s\n", name_string(), mq_2.last_status_string());
if (size == (strlen(u2) + 5))
{
if ((strncmp(in, task_3_1.name_string(), 4) == 0) &&
(strcmp(in + 4, u2) == 0))
{
printf("%s - message u2 received correctly\n", name_string());
}
else
{
printf("%s - message u2 received incorrectly, message='%s', size=%i\n",
name_string(), in, size);
}
}
else
printf("%s - message u2 size incorrect, size=%i\n", name_string(), size);
printf("%s - receive u1 on mq_2 ...\n", name_string()); fflush(stdout);
mq_2.receive(in, size, 5000000);
printf("%s - %s\n", name_string(), mq_2.last_status_string());
if (size == (strlen(u1) + 5))
{
if ((strncmp(in, task_3_2.name_string(), 4) == 0) &&
(strcmp(in + 4, u1) == 0))
{
printf("%s - message u1 received correctly\n", name_string());
}
else
{
printf("%s - message u1 received incorrectly, message='%s', size=%i\n",
name_string(), in, size);
}
}
else
printf("%s - message u1 size incorrect, size=%i\n", name_string(), size);
wake_after(3000000);
char *b1 = "broadcast message";
rtems_unsigned32 count;
printf("%s - broadcast send b1 ...\n", name_string());
mq_2.broadcast(b1, strlen(b1) + 1, count);
printf("%s - mq_2 broadcast send - %s, count=%i\n",
name_string(), mq_2.last_status_string(), count);
wake_after(1000000);
printf("%s - receive message b1 on mq_2 from %s...\n",
name_string(), task_3_1.name_string()); fflush(stdout);
mq_2.receive(in, size, 5000000);
printf("%s - %s\n", name_string(), mq_2.last_status_string());
if (size == (strlen(b1) + 5))
{
if ((strncmp(in, task_3_1.name_string(), 4) == 0) &&
(strcmp(in + 4, b1) == 0))
{
printf("%s - message b1 received correctly\n", name_string());
}
else
{
printf("%s - message b1 received incorrectly, message='%s'\n",
name_string(), in);
}
}
else
printf("%s - message b1 size incorrect, size=%i\n", name_string(), size);
printf("%s - receive message b1 on mq_2 from %s...\n",
name_string(), task_3_1.name_string()); fflush(stdout);
mq_2.receive(in, size, 5000000);
printf("%s - %s\n", name_string(), mq_2.last_status_string());
if (size == (strlen(b1) + 5))
{
if ((strncmp(in, task_3_2.name_string(), 4) == 0) &&
(strcmp(in + 4, b1) == 0))
{
printf("%s - message b1 received correctly\n", name_string());
}
else
{
printf("%s - message b1 received incorrectly, message='%s', size=%i\n",
name_string(), in, size);
}
}
else
printf("%s - message b1 size incorrect, size=%i\n", name_string(), size);
// wait for task 3_1, and 3_2 to complete their timeout tests, will
// start these after getting the broadcast message
wake_after(7000000);
char *f1 = "flush message";
printf("%s - send f1 to mq_2 - ", name_string());
mq_2.send(f1, strlen(f1) + 1);
printf("%s\n", mq_2.last_status_string());
printf("%s - send f1 to mq_2 - ", name_string());
mq_2.send(f1, strlen(f1) + 1);
printf("%s\n", mq_2.last_status_string());
printf("%s - send f1 to mq_2 - ", name_string());
mq_2.send(f1, strlen(f1) + 1);
printf("%s\n", mq_2.last_status_string());
printf("%s - flush mq_2 - ", name_string());
mq_2.flush(size);
printf("%s, flushed=%i\n", mq_2.last_status_string(), size);
printf(" * END MessageQueue Class test *\n");
}
void Task1::print_mode(rtems_mode mode, rtems_mode mask)
{
rtemsTaskMode task_mode;
if (mask & RTEMS_PREEMPT_MASK)
printf("RTEMS_%sPREEMPT ",
task_mode.preemption_set(mode) ? "" : "NO_");
if (mask & RTEMS_TIMESLICE_MASK)
printf("RTEMS_%sTIMESLICE ",
task_mode.preemption_set(mode) ? "" : "NO_");
if (mask & RTEMS_ASR_MASK)
printf("RTEMS_%sASR ",
task_mode.asr_set(mode) ? "" : "NO_");
if (mask & RTEMS_INTERRUPT_MASK)
printf("INTMASK=%i",
mode & RTEMS_INTERRUPT_MASK);
}
EndTask::EndTask(const char* name,
const rtems_task_priority initial_priority,
const rtems_unsigned32 stack_size)
: rtemsTask(name, initial_priority, stack_size, RTEMS_NO_PREEMPT)
{
}
void EndTask::body(rtems_task_argument)
{
printf("*** END OF RTEMS++ TEST ***\n");
exit(0);
}

View File

@@ -1,80 +0,0 @@
/* Task_2
*
* This routine serves as a test task. Its only purpose is to generate the
* error where a semaphore is deleted while a task is waiting for it.
*
* Input parameters:
* argument - task argument
*
* Output parameters: NONE
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#include "System.h"
Task2::Task2(const char* name,
const rtems_task_priority initial_priority,
const rtems_unsigned32 stack_size)
: rtemsTask(name, initial_priority, stack_size, RTEMS_NO_PREEMPT)
{
}
void Task2::body(rtems_task_argument )
{
screen4();
printf("%s - destroy itself\n", name_string());
destroy();
}
void Task2::screen4()
{
rtemsEvent event;
// block waiting for any event
rtems_event_set out;
printf("%s - event no wait - ", name_string());
event.receive(RTEMS_SIGNAL_0, out, 0, rtemsEvent::no_wait);
printf("%s\n", event.last_status_string());
printf("%s - event 5 secs timeout - ", name_string()); fflush(stdout);
event.receive(RTEMS_SIGNAL_0, out, 5000000);
printf("%s\n", event.last_status_string());
// send using task id
printf("%s - event wait forever for signal 0 from TA1 ....\n", name_string());
event.receive(RTEMS_SIGNAL_0, out);
printf("%s - %s, signals out are 0x%08X\n", name_string(), event.last_status_string(), out);
// send using task object reference
printf("%s - event wait forever for signal 0 from TA1 ....\n", name_string());
event.receive(RTEMS_SIGNAL_0, out);
printf("%s - %s, signals out are 0x%08X\n", name_string(), event.last_status_string(), out);
printf("%s - event wait forever for signal 31 from TA1 ....\n", name_string());
event.receive(RTEMS_SIGNAL_31, out);
printf("%s - %s, signals out are 0x%08X\n", name_string(), event.last_status_string(), out);
printf("%s - event wait forever for signal 0 and 31 from TA1 ....\n", name_string());
event.receive(RTEMS_SIGNAL_0 | RTEMS_SIGNAL_31, out, 0, rtemsEvent::wait, rtemsEvent::all);
printf("%s - %s, signals out are 0x%08X\n", name_string(), event.last_status_string(), out);
printf("%s - send event signal 1 - ", name_string());
event.send(RTEMS_SIGNAL_1);
printf("%s\n", event.last_status_string());
printf("%s - event wait forever for signal 1 from TA2 - ", name_string());
event.receive(RTEMS_SIGNAL_1, out, 0, rtemsEvent::wait, rtemsEvent::all);
printf("%s, signals out are 0x%08X\n", event.last_status_string(), out);
}

View File

@@ -1,80 +0,0 @@
/* Task_3
*
* This routine serves as a test task. Loopback the messages and test
* timeouts
*
* Input parameters:
* argument - task argument
*
* Output parameters: NONE
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#include "System.h"
Task3::Task3(const char* name,
const rtems_task_priority initial_priority,
const rtems_unsigned32 stack_size)
: rtemsTask(name, initial_priority, stack_size, RTEMS_NO_PREEMPT)
{
}
void Task3::body(rtems_task_argument )
{
screen6();
printf("%s - destroy itself\n", name_string());
destroy();
}
void Task3::screen6()
{
rtemsMessageQueue mq_2("MQ2");
printf("%s - construction connect mq_2 - %s\n", name_string(), mq_2.last_status_string());
if (mq_2.successful())
{
char in[100];
char out[100];
rtems_unsigned32 size;
bool loopback = true;
while (loopback)
{
printf("%s - loopback from mq_2 to mq_2 ...\n", name_string()); fflush(stdout);
mq_2.receive(in, size);
printf("%s - mq_2 receive - %s, size=%i, message string size=%i\n",
name_string(), mq_2.last_status_string(), size, (int) strlen(in));
if (mq_2.successful())
{
if (size > (100 - 5))
printf("%s - size to large\n", name_string());
else
{
strcpy(out, name_string());
strcpy(out + 4, in);
printf("%s - loopback to mq_2 - ", name_string());
mq_2.send(out, strlen(out) + 1);
printf("%s\n", mq_2.last_status_string());
}
if (strcmp(in, "broadcast message") == 0)
loopback = false;
else
wake_after(1500000);
}
}
}
}

View File

@@ -1,29 +0,0 @@
#
# $Id$
#
# COPYRIGHT (c) 1997
# Objective Design Systems Ltd Pty (ODS)
# All rights reserved (R) Objective Design Systems Ltd Pty
#
# The license and distribution terms for this file may be found in the
# file LICENSE in this distribution or at
# http://www.rtems.com/license/LICENSE.
#
The file describes the directives and concepts tested by this test set.
test set name: rtems++
classes:
rtemsTask, rtemsTaskMode, rtemsEvent, rtemsMessageQueue
concepts:
a. Verify each class tested can be constructed using each of the constructors.
b. Verify each class can be an owner of an object id if capable.
c. Verify each class can connect to an existing object id if capable.
d. Verify the operation of each method of each class.

View File

@@ -1,161 +0,0 @@
*** RTEMS++ TEST ***
INIT - Task.create() - RTEMS[19] invalid thread priority
INIT - Task.create() - RTEMS[00] successful completion
INIT - Task.create() - RTEMS[16] illegal on calling thread
INIT - Task.restart() - RTEMS[14] thread is in wrong state
INIT - Task.start(0xDEADDEAD) - RTEMS[00] successful completion
<pause - screen 1>
* START Task Class test *
TA1 - test argument - argument matched
TA1 - copy constructor - local and this id's match
TA1 - copy constructor - local and this name's match
TA1 - copy operator - local and this id's match
TA1 - copy operator - local and this name's match
TA1 - not owner destroy's task - RTEMS[23] not owner of resource
TA1 - connect to a local valid task name - RTEMS[00] successful completion
TA1 - connect to an invalid task name - RTEMS[03] invalid object name
SELF - connect to a task on an invalid node - RTEMS[21] invalid node id
TA1 - restart from a non-owner - RTEMS[23] not owner of resource
<pause - screen 2>
TA1 - wake after 0 secs - RTEMS[00] successful completion
TA1 - wake after 500 msecs - RTEMS[00] successful completion
TA1 - wake after 5 secs - RTEMS[00] successful completion
TA1 - wake when - to do
TA1 - connected object wake after 0 secs - RTEMS[00] successful completion
TA1 - connected object wake after 500 msecs - RTEMS[00] successful completion
TA1 - connected object wake after 5 secs - RTEMS[00] successful completion
TA1 - connected object wake when - to do
SELF - self object wake after 0 secs - RTEMS[00] successful completion
SELF - self object wake after 500 msecs - RTEMS[00] successful completion
SELF - self object wake after 5 secs - RTEMS[00] successful completion
SELF - self object wake when - to do
TA1 - get priority - RTEMS[00] successful completion, priority is 10
TA1 - set priority to 512 - RTEMS[19] invalid thread priority
TA1 - set priority to 25 - RTEMS[00] successful completion
TA1 - set priority to original - RTEMS[00] successful completion, priority was 25
TA1 - connected object get priority - RTEMS[00] successful completion, priority is 10
TA1 - connected object set priority to 512 - RTEMS[19] invalid thread priority
TA1 - connected object set priority to 25 - RTEMS[00] successful completion
TA1 - connected object set priority to original - RTEMS[00] successful completion, priority was 25
SELF - self object get priority - RTEMS[00] successful completion, priority is 10
SELF - self object set priority to 512 - RTEMS[19] invalid thread priority
SELF - self object set priority to 25 - RTEMS[00] successful completion
SELF - self object set priority to original - RTEMS[00] successful completion, priority was 25
TA1 - get note - RTEMS[00] successful completion, note is 0
TA1 - get with bad notepad number - RTEMS[10] number was invalid, note is 0
TA1 - set note to 0xDEADBEEF - RTEMS[00] successful completion
TA1 - get note - RTEMS[00] successful completion, note is 0xDEADBEEF
TA1 - set note to original value - RTEMS[00] successful completion
TA1 - connected object get note - RTEMS[00] successful completion, notepad is 0
TA1 - connected object get with bad notepad number - RTEMS[10] number was invalid, note is 0
TA1 - connected object set note to 0xDEADBEEF - RTEMS[00] successful completion
TA1 - connected object get note - RTEMS[00] successful completion, note is 0xDEADBEEF
TA1 - connected object set note to original value - RTEMS[00] successful completion
SELF - self object get note - RTEMS[00] successful completion, note is 0
SELF - self object get with bad notepad number - RTEMS[10] number was invalid, note is 0
SELF - self object set note to 0xDEADBEEF - RTEMS[00] successful completion
SELF - self object get note - RTEMS[00] successful completion, notepad is 0xDEADBEEF
SELF - self object set note to original value - RTEMS[00] successful completion
* END Task Class test *
<pause - screen 3>
* START TaskMode Class test *
SELF - get mode - RTEMS[00] successful completion,
mode is 0x00000100, RTEMS_NO_PREEMPT RTEMS_NO_TIMESLICE RTEMS_NO_ASR INTMASK=0
SELF - get preemption state - RTEMS[00] successful completion,
mode is 0x00000100, RTEMS_NO_PREEMPT
SELF - set preemption state to RTEMS_PREEMPT - RTEMS[00] successful completion,
mode is 0x00000000, RTEMS_PREEMPT RTEMS_TIMESLICE RTEMS_NO_ASR INTMASK=0
SELF - set preemption state to RTEMS_NO_PREEMPT - RTEMS[00] successful completion,
mode is 0x00000100, RTEMS_NO_PREEMPT RTEMS_NO_TIMESLICE RTEMS_NO_ASR INTMASK=0
SELF - get timeslice state - RTEMS[00] successful completion,
mode is 0x00000000, RTEMS_TIMESLICE
SELF - set timeslice state to RTEMS_TIMESLICE - RTEMS[00] successful completion,
mode is 0x00000300, RTEMS_NO_PREEMPT RTEMS_NO_TIMESLICE RTEMS_NO_ASR INTMASK=0
SELF - set timeslice state to RTEMS_NO_TIMESLICE - RTEMS[00] successful completion,
mode is 0x00000100, RTEMS_NO_PREEMPT RTEMS_NO_TIMESLICE RTEMS_NO_ASR INTMASK=0
SELF - get asr state - RTEMS[00] successful completion,
mode is 0x00000000, RTEMS_NO_ASR
SELF - set asr state to RTEMS_ASR - RTEMS[00] successful completion,
mode is 0x00000100, RTEMS_NO_PREEMPT RTEMS_NO_TIMESLICE RTEMS_NO_ASR INTMASK=0
SELF - set asr state to RTEMS_NO_ASR - RTEMS[00] successful completion,
mode is 0x00000500, RTEMS_NO_PREEMPT RTEMS_NO_TIMESLICE RTEMS_ASR INTMASK=0
SELF - get current interrupt level - RTEMS[00] successful completion, level is 0
SELF - set interrupt level to 102 - RTEMS[00] successful completion
SELF - set interrupt level to original level - RTEMS[00] successful completion, level was 0
SELF - set mode to original mode - RTEMS[00] successful completion,
mode is 0x00000100, RTEMS_NO_PREEMPT RTEMS_NO_TIMESLICE RTEMS_NO_ASR INTMASK=0
* END TaskMode Class test *
<pause - screen 4>
* START Event Class test *
TA1 - create task 2 - RTEMS[00] successful completion
TA1 - start task 2 - RTEMS[00] successful completion
TA1 - construct event connecting to task 2 - RTEMS[00] successful completion
TA2 - event no wait - RTEMS[13] request not satisfied
TA2 - event 5 secs timeout - RTEMS[06] timed out waiting
TA2 - event wait forever for signal 0 from TA1 ....
TA1 - send event signal 0 using the task id - RTEMS[00] successful completion
TA2 - RTEMS[00] successful completion, signals out are 0x00000001
TA2 - event wait forever for signal 0 from TA1 ....
TA1 - send event signal 0 using the task object reference - RTEMS[00] successful completion
TA2 - RTEMS[00] successful completion, signals out are 0x00000001
TA2 - event wait forever for signal 31 from TA1 ....
TA1 - send event signal 31 using connected id - RTEMS[00] successful completion
TA2 - RTEMS[00] successful completion, signals out are 0x80000000
TA2 - event wait forever for signal 0 and 31 from TA1 ....
TA1 - send event signal 0 and 31 - RTEMS[00] successful completion
TA1 - waiting 5 secs for TA2 to finish
TA2 - RTEMS[00] successful completion, signals out are 0x80000001
TA2 - send event signal 1 - RTEMS[00] successful completion
TA2 - event wait forever for signal 1 from TA2 - RTEMS[00] successful completion, signals out are 0x00000002
TA2 - destory itself
* END Event Class test *
<pause - screen 5>
* START Interrupt Class test *
do not know a portable BSP type interrupt test
* END Interrupt Class test *
<pause - screen 6>
* START MessageQueue Class test *
TA1 - construct message queue 1 with no memory error - RTEMS[05] too many
TA1 - construct/create message queue 2 - RTEMS[00] successful completion
TA1 - send u1 to mq_2 - RTEMS[00] successful completion
TA1 - urgent send u2 to mq_2 - RTEMS[00] successful completion
TA1 - create task 3_1 - RTEMS[00] successful completion
TA1 - start task 3_1 - RTEMS[00] successful completion
TA1 - create task 3_2 - RTEMS[00] successful completion
TA1 - start task 3_2 - RTEMS[00] successful completion
TA31 - construction connect mq_2 - RTEMS[00] successful completion
TA31 - loopback from mq_2 to mq_2 ...
TA31 - mq_2 receive - RTEMS[00] successful completion, size=12, message string size=11
TA31 - loopback to mq_2 - RTEMS[00] successful completion
TA32 - construction connect mq_2 - RTEMS[00] successful completion
TA32 - loopback from mq_2 to mq_2 ...
TA32 - mq_2 receive - RTEMS[00] successful completion, size=12, message string size=11
TA32 - loopback to mq_2 - RTEMS[00] successful completion
TA1 - receive u2 on mq_2 ...
TA1 - RTEMS[00] successful completion
TA1 - message u2 received correctly
TA1 - receive u1 on mq_2 ...
TA1 - RTEMS[00] successful completion
TA1 - message u1 received correctly
TA31 - loopback from mq_2 to mq_2 ...
TA32 - loopback from mq_2 to mq_2 ...
TA1 - broadcast send b1 ...
TA1 - mq_2 broadcast send - RTEMS[00] successful completion, count=2
TA31 - mq_2 receive - RTEMS[00] successful completion, size=18, message string size=17
TA31 - loopback to mq_2 - RTEMS[00] successful completion
TA31 - destory itself
TA32 - mq_2 receive - RTEMS[00] successful completion, size=18, message string size=17
TA32 - loopback to mq_2 - RTEMS[00] successful completion
TA32 - destory itself
TA1 - receive message b1 on mq_2 from TA31...
TA1 - RTEMS[00] successful completion
TA1 - message b1 received correctly
TA1 - receive message b1 on mq_2 from TA31...
TA1 - RTEMS[00] successful completion
TA1 - message b1 received correctly
TA1 - send f1 to mq_2 - RTEMS[00] successful completion
TA1 - send f1 to mq_2 - RTEMS[00] successful completion
TA1 - send f1 to mq_2 - RTEMS[00] successful completion
TA1 - flush mq_2 - RTEMS[00] successful completion, flushed=3
* END MessageQueue Class test *
<pause - screen 7>

View File

@@ -1,2 +0,0 @@
Makefile
Makefile.in

View File

@@ -1,42 +0,0 @@
##
## $Id$
##
TEST = rtmonuse
MANAGERS = io rate_monotonic
C_FILES = init.c getall.c task1.c
C_O_FILES = $(C_FILES:%.c=${ARCH}/%.$(OBJEXT))
H_FILES = system.h
noinst_HEADERS = $(H_FILES)
DOCTYPES = scn
DOCS = $(DOCTYPES:%=$(TEST).%)
SRCS = $(DOCS) $(C_FILES) $(H_FILES)
OBJS = $(C_O_FILES)
PRINT_SRCS = $(DOCS)
PGM = ${ARCH}/$(TEST).exe
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../automake/compile.am
include $(top_srcdir)/../automake/leaf.am
include $(top_srcdir)/libtests.am
#
# (OPTIONAL) Add local stuff here using +=
#
${PGM}: $(OBJS) $(LINK_FILES)
$(make-exe)
all-local: $(ARCH) $(TMPINSTALL_FILES)
EXTRA_DIST = $(C_FILES) $(DOCS)
include $(top_srcdir)/../automake/local.am

View File

@@ -1,42 +0,0 @@
/* Get_all_counters
*
* This routine allows TA5 to atomically obtain the iteration counters.
*
* Input parameters: NONE
*
* Output parameters: NONE
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#include "system.h"
void Get_all_counters()
{
rtems_mode previous_mode;
rtems_status_code status;
status = rtems_task_mode(
RTEMS_NO_PREEMPT,
RTEMS_PREEMPT_MASK,
&previous_mode
);
directive_failed( status, "rtems_task_mode to RTEMS_NO_PREEMPT" );
Temporary_count = Count;
Count.count[ 1 ] = 0;
Count.count[ 2 ] = 0;
Count.count[ 3 ] = 0;
Count.count[ 4 ] = 0;
Count.count[ 5 ] = 0;
status = rtems_task_mode( RTEMS_PREEMPT, RTEMS_PREEMPT_MASK, &previous_mode );
directive_failed( status, "rtems_task_mode to RTEMS_PREEMPT" );
}

View File

@@ -1,70 +0,0 @@
/* Init
*
* This routine is the initialization task for this test program.
* It is a user initialization task and has the responsibility for creating
* and starting the tasks that make up the test. If the time of day
* clock is required for the test, it should also be set to a known
* value by this function.
*
* Input parameters:
* argument - task argument
*
* Output parameters: NONE
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#define TEST_INIT
#include "system.h"
#include <rtems/rtmonuse.h>
rtems_task Init(
rtems_task_argument argument
)
{
rtems_unsigned32 index;
rtems_status_code status;
puts( "\n\n*** RATE MONOTONIC PERIOD STATISTICS TEST ***" );
Period_usage_Initialize();
Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
Task_name[ 4 ] = rtems_build_name( 'T', 'A', '4', ' ' );
Task_name[ 5 ] = rtems_build_name( 'T', 'A', '5', ' ' );
for ( index = 1 ; index <= 5 ; index++ ) {
status = rtems_task_create(
Task_name[ index ],
Priorities[ index ],
RTEMS_MINIMUM_STACK_SIZE * 4,
RTEMS_DEFAULT_MODES,
(index == 5) ? RTEMS_FLOATING_POINT : RTEMS_DEFAULT_ATTRIBUTES,
&Task_id[ index ]
);
directive_failed( status, "rtems_task_create loop" );
}
for ( index = 1 ; index <= 5 ; index++ ) {
status = rtems_task_start( Task_id[ index ], Task_1_through_5, index );
directive_failed( status, "rtems_task_start loop" );
}
Count.count[ 1 ] = 0;
Count.count[ 2 ] = 0;
Count.count[ 3 ] = 0;
Count.count[ 4 ] = 0;
Count.count[ 5 ] = 0;
status = rtems_task_delete( RTEMS_SELF );
directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
}

View File

@@ -1,27 +0,0 @@
*** TEST 20 ***
TA1 - rtems_rate_monotonic_create id = 0x28010001
TA1 - rtems_rate_monotonic_ident id = 0x28010001
TA1 - (0x28010001) period 2
TA2 - rtems_rate_monotonic_create id = 0x28010002
TA2 - rtems_rate_monotonic_ident id = 0x28010002
TA2 - (0x28010002) period 2
TA3 - rtems_rate_monotonic_create id = 0x28010003
TA3 - rtems_rate_monotonic_ident id = 0x28010003
TA3 - (0x28010003) period 2
TA4 - rtems_rate_monotonic_create id = 0x28010004
TA4 - rtems_rate_monotonic_ident id = 0x28010004
TA4 - (0x28010004) period 2
TA5 - rtems_rate_monotonic_create id = 0x28010005
TA5 - rtems_rate_monotonic_ident id = 0x28010005
TA5 - (0x28010005) period 100
TA5 - PERIODS CHECK OK (1)
TA5 - PERIODS CHECK OK (2)
TA5 - PERIODS CHECK OK (3)
TA5 - PERIODS CHECK OK (4)
TA5 - PERIODS CHECK OK (5)
TA5 - PERIODS CHECK OK (6)
TA5 - PERIODS CHECK OK (7)
TA5 - PERIODS CHECK OK (8)
TA5 - PERIODS CHECK OK (9)
TA5 - PERIODS CHECK OK (10)
*** END OF TEST 20 ***

View File

@@ -1,61 +0,0 @@
/* system.h
*
* This include file contains information that is included in every
* function in the test set.
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#include <tmacros.h>
/* types */
struct counters {
rtems_unsigned32 count[6];
};
/* functions */
rtems_task Init(
rtems_task_argument argument
);
rtems_task Task_1_through_5(
rtems_task_argument argument
);
void Get_all_counters( void );
/* configuration information */
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_MAXIMUM_TASKS 6
#define CONFIGURE_MAXIMUM_PERIODS 10
#define CONFIGURE_INIT_TASK_PRIORITY 10
#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_EXTRA_TASK_STACKS (15 * RTEMS_MINIMUM_STACK_SIZE)
#include <confdefs.h>
/* global variables */
TEST_EXTERN rtems_id Task_id[ 6 ]; /* array of task ids */
TEST_EXTERN rtems_name Task_name[ 6 ]; /* array of task names */
TEST_EXTERN struct counters Count; /* iteration counters */
TEST_EXTERN struct counters Temporary_count;
extern rtems_task_priority Priorities[ 6 ];
/* end of include file */

View File

@@ -1,123 +0,0 @@
/* Task_1_through_5
*
* This routine serves as a test task for the period capabilities of the
* Rate Monotonic Manager.
*
* Input parameters:
* argument - task argument
*
* Output parameters: NONE
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#include "system.h"
#include <rtems/cpuuse.h>
#include <rtems/rtmonuse.h>
rtems_unsigned32 Periods[6] = { 0, 2, 2, 2, 2, 100 };
rtems_unsigned32 Iterations[6] = { 0, 50, 50, 50, 50, 1 };
rtems_task_priority Priorities[6] = { 0, 1, 1, 3, 4, 5 };
rtems_task Task_1_through_5(
rtems_unsigned32 argument
)
{
rtems_id rmid;
rtems_id test_rmid;
rtems_unsigned32 index;
rtems_unsigned32 pass;
rtems_unsigned32 failed;
rtems_status_code status;
status = rtems_rate_monotonic_create( argument, &rmid );
directive_failed( status, "rtems_rate_monotonic_create" );
put_name( Task_name[ argument ], FALSE );
printf( "- rtems_rate_monotonic_create id = 0x%08x\n", rmid );
status = rtems_rate_monotonic_ident( argument, &test_rmid );
directive_failed( status, "rtems_rate_monotonic_ident" );
put_name( Task_name[ argument ], FALSE );
printf( "- rtems_rate_monotonic_ident id = 0x%08x\n", test_rmid );
if ( rmid != test_rmid ) {
printf( "RMID's DO NOT MATCH (0x%x and 0x%x)\n", rmid, test_rmid );
rtems_test_exit( 0 );
}
put_name( Task_name[ argument ], FALSE );
printf( "- (0x%08x) period %d\n", rmid, Periods[ argument ] );
status = rtems_task_wake_after( 2 );
directive_failed( status, "rtems_task_wake_after" );
switch ( argument ) {
case 1:
case 2:
case 3:
case 4:
while ( FOREVER ) {
Period_usage_Update( rmid );
status = rtems_rate_monotonic_period( rmid, Periods[ argument ] );
directive_failed( status, "rtems_rate_monotonic_period" );
Count.count[ argument ]++;
}
break;
case 5:
pass = 0;
failed = 0;
status = rtems_rate_monotonic_period( rmid, Periods[ argument ] );
directive_failed( status, "rtems_rate_monotonic_period 1 of TA5" );
Get_all_counters();
while ( FOREVER ) {
Period_usage_Update( rmid );
status = rtems_rate_monotonic_period( rmid, Periods[ argument ] );
directive_failed( status, "rtems_rate_monotonic_period 2 of TA5" );
Get_all_counters();
for( index = 1 ; index <= 4 ; index++ ) {
if ( Temporary_count.count[ index ] != Iterations[ index ] ) {
puts_nocr( "FAIL -- " );
put_name ( Task_name[ index ], FALSE );
printf ( " Actual=%d, Expected=%d\n",
Temporary_count.count[ index ],
Iterations[ index ]
);
failed += 1;
}
}
if ( failed == 5 )
rtems_test_exit( 0 );
pass += 1;
printf( "TA5 - PERIODS CHECK OK (%d)\n", pass );
fflush( stdout );
if ( pass == 10 ) {
puts( "*** END OF RATE MONOTONIC PERIOD STATISTICS TEST ***" );
CPU_usage_Dump();
Period_usage_Dump();
rtems_test_exit( 0 );
}
}
break;
}
}

View File

@@ -1,2 +0,0 @@
Makefile
Makefile.in

View File

@@ -1,42 +0,0 @@
##
## $Id$
##
TEST = stackchk
MANAGERS = io
C_FILES = blow.c init.c task1.c
C_O_FILES = $(C_FILES:%.c=${ARCH}/%.$(OBJEXT))
H_FILES = system.h
noinst_HEADERS = $(H_FILES)
DOCTYPES = scn
DOCS = $(DOCTYPES:%=$(TEST).%)
SRCS = $(DOCS) $(C_FILES) $(H_FILES)
OBJS = $(C_O_FILES)
PRINT_SRCS = $(DOCS)
PGM = ${ARCH}/$(TEST).exe
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../automake/compile.am
include $(top_srcdir)/../automake/leaf.am
include $(top_srcdir)/libtests.am
#
# (OPTIONAL) Add local stuff here using +=
#
${PGM}: $(OBJS) $(LINK_FILES)
$(make-exe)
all-local: $(ARCH) $(TMPINSTALL_FILES)
EXTRA_DIST = $(C_FILES) $(DOCS)
include $(top_srcdir)/../automake/local.am

View File

@@ -1,48 +0,0 @@
/* task1.c
*
* This set of three tasks do some simple task switching for about
* 15 seconds and then call a routine to "blow the stack".
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#include <rtems.h>
void b() {}
void blow_stack( void )
{
volatile unsigned32 *low, *high;
unsigned char *area;
b();
/*
* Destroy the first and last 16 bytes of our stack... Hope it
* does not cause problems :)
*/
area = (unsigned char *)_Thread_Executing->Start.Initial_stack.area;
low = (volatile unsigned32 *) (area + HEAP_OVERHEAD);
high = (volatile unsigned32 *)
(area + _Thread_Executing->Start.Initial_stack.size - 16);
low[0] = 0x11111111;
low[1] = 0x22222222;
low[2] = 0x33333333;
low[3] = 0x44444444;
high[0] = 0x55555555;
high[1] = 0x66666666;
high[2] = 0x77777777;
high[3] = 0x88888888;
}

View File

@@ -1,85 +0,0 @@
/* Init
*
* This routine is the initialization task for this test program.
* It is a user initialization task and has the responsibility for creating
* and starting the tasks that make up the test. If the time of day
* clock is required for the test, it should also be set to a known
* value by this function.
*
* Input parameters:
* argument - task argument
*
* Output parameters: NONE
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#define TEST_INIT
#include "system.h"
rtems_task Init(
rtems_task_argument argument
)
{
rtems_time_of_day time;
rtems_status_code status;
puts( "\n\n*** TEST STACK CHECKER ***" );
build_time( &time, 12, 31, 1988, 9, 0, 0, 0 );
status = rtems_clock_set( &time );
directive_failed( status, "rtems_clock_set" );
Task_name[ 1 ] = rtems_build_name( 'T', 'A', '1', ' ' );
Task_name[ 2 ] = rtems_build_name( 'T', 'A', '2', ' ' );
Task_name[ 3 ] = rtems_build_name( 'T', 'A', '3', ' ' );
status = rtems_task_create(
Task_name[ 1 ],
1,
TASK_STACK_SIZE,
RTEMS_DEFAULT_MODES,
RTEMS_DEFAULT_ATTRIBUTES,
&Task_id[ 1 ]
);
directive_failed( status, "rtems_task_create of TA1" );
status = rtems_task_create(
Task_name[ 2 ],
1,
TASK_STACK_SIZE,
RTEMS_DEFAULT_MODES,
RTEMS_DEFAULT_ATTRIBUTES,
&Task_id[ 2 ]
);
directive_failed( status, "rtems_task_create of TA2" );
status = rtems_task_create(
Task_name[ 3 ],
1,
TASK_STACK_SIZE,
RTEMS_DEFAULT_MODES,
RTEMS_DEFAULT_ATTRIBUTES,
&Task_id[ 3 ]
);
directive_failed( status, "rtems_task_create of TA3" );
status = rtems_task_start( Task_id[ 1 ], Task_1_through_3, 0 );
directive_failed( status, "rtems_task_start of TA1" );
status = rtems_task_start( Task_id[ 2 ], Task_1_through_3, 0 );
directive_failed( status, "rtems_task_start of TA2" );
status = rtems_task_start( Task_id[ 3 ], Task_1_through_3, 0 );
directive_failed( status, "rtems_task_start of TA3" );
status = rtems_task_delete( RTEMS_SELF );
directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
}

View File

@@ -1,9 +0,0 @@
*** TEST STACK CHECKER ***
TA1 - rtems_clock_get - 09:00:00 12/31/1988
TA2 - rtems_clock_get - 09:00:00 12/31/1988
TA3 - rtems_clock_get - 09:00:00 12/31/1988
TA1 - rtems_clock_get - 09:00:05 12/31/1988
TA1 - rtems_clock_get - 09:00:10 12/31/1988
TA2 - rtems_clock_get - 09:00:10 12/31/1988
TA1 - rtems_clock_get - 09:00:15 12/31/1988
---> error indictation

View File

@@ -1,53 +0,0 @@
/* system.h
*
* This include file contains information that is included in every
* function in the test set.
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#include <tmacros.h>
/* macros */
/* functions */
rtems_task Init(
rtems_task_argument argument
);
rtems_task Task_1_through_3(
rtems_task_argument argument
);
void blow_stack( void );
/* configuration information */
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define TASK_STACK_SIZE (RTEMS_MINIMUM_STACK_SIZE*3)
#define CONFIGURE_MAXIMUM_TASKS 4
#define CONFIGURE_EXTRA_TASK_STACKS (3 * (RTEMS_MINIMUM_STACK_SIZE * 2))
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define STACK_CHECKER_ON
#include <confdefs.h>
/* global variables */
TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
TEST_EXTERN rtems_name Task_name[ 4 ]; /* array of task names */
/* end of include file */

View File

@@ -1,43 +0,0 @@
/* task1.c
*
* This set of three tasks do some simple task switching for about
* 15 seconds and then call a routine to "blow the stack".
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#include "system.h"
rtems_task Task_1_through_3(
rtems_task_argument argument
)
{
rtems_id tid;
rtems_time_of_day time;
rtems_status_code status;
status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid );
directive_failed( status, "rtems_task_ident" );
while( FOREVER ) {
status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
directive_failed( status, "rtems_clock_get" );
if ( time.second >= 15 && tid == Task_id[ 1 ] ) {
blow_stack();
}
put_name( Task_name[ task_number( tid ) ], FALSE );
print_time( " - rtems_clock_get - ", &time, "\n" );
status = rtems_task_wake_after( task_number( tid ) * 5 * TICKS_PER_SECOND );
directive_failed( status, "rtems_task_wake_after" );
}
}

View File

@@ -1,2 +0,0 @@
Makefile
Makefile.in

View File

@@ -1,42 +0,0 @@
##
## $Id$
##
TEST = termios
MANAGERS = io
C_FILES = init.c
C_O_FILES = $(C_FILES:%.c=${ARCH}/%.$(OBJEXT))
H_FILES =
noinst_HEADERS = $(H_FILES)
DOCTYPES =
DOCS = $(DOCTYPES:%=$(TEST).%)
SRCS = $(DOCS) $(C_FILES) $(CC_FILES) $(H_FILES) $(S_FILES)
OBJS = $(C_O_FILES) $(CC_O_FILES) $(S_O_FILES)
PRINT_SRCS = $(DOCS)
PGM = ${ARCH}/$(TEST).exe
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../automake/compile.am
include $(top_srcdir)/../automake/leaf.am
include $(top_srcdir)/libtests.am
#
# (OPTIONAL) Add local stuff here using +=
#
${PGM}: $(OBJS) $(LINK_FILES)
$(make-exe)
all-local: $(ARCH) $(TMPINSTALL_FILES)
EXTRA_DIST = $(C_FILES) $(DOCS)
include $(top_srcdir)/../automake/local.am

View File

@@ -1,99 +0,0 @@
#
# $Id$
#
These tests are brought to you by the letter `q'.
When you start the test, you should see:
You have the following choices:
1 - Reset the struct termios
2 - Look at the current termios setting
3 - Change the line characteristics
4 - Test canonical input
5 - Test raw input
9 - Exit
Enter your choice (1 to 5 or 9, followed by a carriage return):
The individual tests are briefly described below:
1. Reset the struct termios.
Included just in case you get into trouble. More than likely, if you are in
trouble, neither input nor output are likely to work and this won't help. But
hey, it should give you some warm fuzzy feeling that its there...
2. Look at the current termios setting
Dumps the current state of the termios settings in hex and with symbolic flag
names.
3. Change the line characteristics
Allows you to change the line speed, parity, number of data bits and number of
stop bits. You must supply a delay before the change takes effect. This gives
you time to switch your terminal settings to continue with the test.
WARNING: Minicom under Linux gets extremely unhappy (as does the /dev/ttyS?
underlying devices) if you change the line characteristics and do not make the
corresponding change in the terminal emulator.
4. Test canonical input
Simple test of canonical or cooked input mode. Try typing some tabs and/or control characters and make sure that you can backspace over them properly.
5. Test raw input
The line is placed into raw mode and four separate test are done:
VMIN=0, VTIME=0
Each letter you type should produce a line of output.
The `count' should be quite large, since (as you correctly
pointed out) the read is non-blocking. The time should be
the interval between typing characters.
Type a `q' to finish the test.
VMIN=0, VTIME=20
Again, each letter should produce a line of output. The
`count' should be much smaller -- the read is non-blocking
but has a timeout of 2 seconds, so the count should be about
half the `interval'.
Type a `q' to finish the test.
VMIN=5, VTIME=0
A line should be produced for every 5 characters typed. The
count should be 1. This is a blocking read.
Type a `q' as the first character of a group of 5 to finish
the test.
VMIN=5, VTIME=20
Type a character. Two seconds later a line should be printed.
Count should be 1. Type a character, and another within 2 seconds.
Two seconds after last character (or right after the 5th character)
a line should be printed.
Type a `q' as the first character of a group to finish the test.
9. Exit
Gets you out of the test.
Clear???
---
Eric Norum
eric@skatter.usask.ca
Saskatchewan Accelerator Laboratory
University of Saskatchewan
Saskatoon, Canada.
Charles-Antoine Gauthier
Software Engineering Group
Institute for Information Technology
National Research Council of Canada
charles.gauthier@nrc.ca

View File

@@ -1,781 +0,0 @@
/*
* RTEMS configuration/initialization
*
* This program may be distributed and used for any purpose.
* I ask only that you:
* 1. Leave this author information intact.
* 2. Document any changes you make.
*
* W. Eric Norum
* Saskatchewan Accelerator Laboratory
* University of Saskatchewan
* Saskatoon, Saskatchewan, CANADA
* eric@skatter.usask.ca
*
* Additions:
* Charles-Antoine Gauthier
* Software Engineering Group
* Institute for Information Technology
* National Research Council of Canada
* charles.gauthier@nrc.ca
*
* $Id$
*/
#include <bsp.h>
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_MAXIMUM_TASKS 1
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_MICROSECONDS_PER_TICK 1000
#define CONFIGURE_INIT
rtems_task Init (rtems_task_argument argument);
#include <confdefs.h>
#include <stdio.h>
#include <unistd.h>
#include <termios.h>
#include <errno.h>
#include <string.h>
#include <tmacros.h>
#if !defined(fileno)
int fileno( FILE *stream); /* beyond ANSI */
#endif
/* Some of the termios dumping code depends on bit positions! */
void print_32bits( unsigned long bits, unsigned char size, char * names[] )
{
unsigned char i;
for( i = 0; i < size; i++ ) {
if( (bits >> i) & 0x1 )
printf( "%s ", names[i] );
}
}
void print_c_iflag( struct termios * tp )
{
char * c_iflag_bits [] = {
"IGNBRK", /* 0000001 */
"BRKINT", /* 0000002 */
"IGNPAR", /* 0000004 */
"PARMRK", /* 0000010 */
"INPCK", /* 0000020 */
"ISTRIP", /* 0000040 */
"INLCR", /* 0000100 */
"IGNCR", /* 0000200 */
"ICRNL", /* 0000400 */
"IUCLC", /* 0001000 */
"IXON", /* 0002000 */
"IXANY", /* 0004000 */
"IXOFF", /* 0010000 */
"IMAXBEL", /* 0020000 */
"unknown", /* 0040000 */
"unknown", /* 0100000 */
"unknown", /* 0200000 */
"unknown", /* 0400000 */
"unknown", /* 1000000 */
"unknown", /* 2000000 */
"unknown" /* 4000000 */
};
printf( "c_iflag = 0x%08x\n\t", tp->c_iflag );
print_32bits( tp->c_iflag, sizeof( c_iflag_bits )/sizeof( char * ), c_iflag_bits );
printf( "\n" );
}
void print_c_oflag( struct termios * tp )
{
printf( "c_oflag = 0x%08x\n\t", tp->c_oflag );
if( tp->c_oflag & OPOST )
printf( "OPOST " );
if( tp->c_oflag & OLCUC )
printf( "OLCUC " );
if( tp->c_oflag & ONLCR )
printf( "ONLCR " );
if( tp->c_oflag & OCRNL )
printf( "OCRNL " );
if( tp->c_oflag & ONOCR )
printf( "ONOCR " );
if( tp->c_oflag & ONLRET )
printf( "ONLRET " );
if( tp->c_oflag & OFILL )
printf( "OFILL " );
if( tp->c_oflag & OFDEL )
printf( "OFDEL " );
switch( tp->c_oflag & NLDLY ) {
case NL0:
printf( "NL0 " );
break;
case NL1:
printf( "NL1 " );
break;
}
switch( tp->c_oflag & CRDLY ) {
case CR0:
printf( "CR0 " );
break;
case CR1:
printf( "CR1 " );
break;
case CR2:
printf( "CR2 " );
break;
case CR3:
printf( "CR3 " );
break;
}
switch( tp->c_oflag & TABDLY ) {
case TAB0:
printf( "TAB0 " );
break;
case TAB1:
printf( "TAB1 " );
break;
case TAB2:
printf( "TAB2 " );
break;
case TAB3:
printf( "TAB3 " );
break;
}
switch( tp->c_oflag & BSDLY ) {
case BS0:
printf( "BS0 " );
break;
case BS1:
printf( "BS1 " );
break;
}
switch( tp->c_oflag & VTDLY ) {
case VT0:
printf( "VT0 " );
break;
case VT1:
printf( "VT1 " );
break;
}
switch( tp->c_oflag & FFDLY ) {
case FF0:
printf( "FF0" );
break;
case FF1:
printf( "FF1" );
break;
}
printf( "\n" );
}
void print_c_lflag( struct termios * tp )
{
char * c_lflag_bits [] = {
"ISIG", /* 0000001 */
"ICANON", /* 0000002 */
"XCASE", /* 0000004 */
"ECHO", /* 0000010 */
"ECHOE", /* 0000020 */
"ECHOK", /* 0000040 */
"ECHONL", /* 0000100 */
"NOFLSH", /* 0000200 */
"TOSTOP", /* 0000400 */
"ECHOCTL", /* 0001000 */
"ECHOPRT", /* 0002000 */
"ECHOKE", /* 0004000 */
"FLUSHO", /* 0010000 */
"unknown", /* 0020000 */
"PENDIN", /* 0040000 */
"IEXTEN", /* 0100000 */
"unknown", /* 0200000 */
"unknown", /* 0400000 */
"unknown", /* 1000000 */
"unknown", /* 2000000 */
"unknown", /* 4000000 */
};
printf( "c_lflag = 0x%08x\n\t", tp->c_lflag );
print_32bits( tp->c_lflag, sizeof( c_lflag_bits )/sizeof( char * ), c_lflag_bits );
printf( "\n" );
}
void print_c_cflag( struct termios * tp )
{
unsigned int baud;
printf( "c_cflag = 0x%08x\n", tp->c_cflag );
baud = (tp->c_cflag & CBAUD) ;
#if defined(__sh2__)
if ( tp->c_cflag & CBAUDEX )
#endif
switch( baud ) {
case B0:
printf( "\tCBAUD =\tB0\n" );
break;
case B50:
printf( "\tCBAUD =\tB50\n" );
break;
case B75:
printf( "\tCBAUD =\tB75\n" );
break;
case B110:
printf( "\tCBAUD =\tB110\n" );
break;
case B134:
printf( "\tCBAUD =\tB134\n" );
break;
case B150:
printf( "\tCBAUD =\tB150\n" );
break;
case B200:
printf( "\tCBAUD =\tB200\n" );
break;
case B300:
printf( "\tCBAUD =\tB300\n" );
break;
case B600:
printf( "\tCBAUD =\tB600\n" );
break;
case B1200:
printf( "\tCBAUD =\tB1200\n" );
break;
case B1800:
printf( "\tCBAUD =\tB1800\n" );
break;
case B2400:
printf( "\tCBAUD =\tB2400\n" );
break;
case B4800:
printf( "\tCBAUD =\tB4800\n" );
break;
case B9600:
printf( "\tCBAUD =\tB9600\n" );
break;
case B19200:
printf( "\tCBAUD =\tB19200\n" );
break;
case B38400:
printf( "\tCBAUD =\tB38400\n" );
break;
#if defined(__sh2__)
}
else
switch ( baud )
{
#endif
case B57600:
printf( "\tCBAUD =\tB57600\n" );
break;
case B115200:
printf( "\tCBAUD =\tB115200\n" );
break;
case B230400:
printf( "\tCBAUD =\tB230400\n" );
break;
case B460800:
printf( "\tCBAUD =\tB460800\n" );
break;
default:
printf( "\tCBAUD =\tunknown (0x%08x)\n", baud );
break;
}
switch( tp->c_cflag & CSIZE ) {
case CS5:
printf( "\tCSIZE =\tCS5\n" );
break;
case CS6:
printf( "\tCSIZE =\tCS6\n" );
break;
case CS7:
printf( "\tCSIZE =\tCS7\n" );
break;
case CS8:
printf( "\tCSIZE =\tCS8\n" );
break;
}
if( tp->c_cflag & CSTOPB )
printf( "\tCSTOPB set: send 2 stop bits\n" );
else
printf( "\tCSTOPB clear: send 1 stop bit\n" );
if( tp->c_cflag & PARENB )
printf( "\tPARENB set: parity enabled\n" );
else
printf( "\tPARENB clear: parity disabled\n" );
if( tp->c_cflag & PARODD )
printf( "\tPARODD set: parity odd\n" );
else
printf( "\tPARODD clear: parity even\n" );
if( tp->c_cflag & CREAD )
printf( "\tCREAD set: receiver enabled\n" );
else
printf( "\tCREAD clear: treceiver disabled\n" );
if( tp->c_cflag & HUPCL )
printf( "\tHUPCL set: enabled\n" );
else
printf( "\tHUPCL clear: disabled\n" );
if( tp->c_cflag & CLOCAL )
printf( "\tCLOCAL set: ignore modem lines\n" );
else
printf( "\tCLOCAL clear: don't ignore modem lines\n" );
#if defined(CBAUDEX)
if( tp->c_cflag & CBAUDEX )
printf( "\tCBAUDEX set: What does this do?\n" );
else
printf( "\tCBAUDEX clear: What does this do?\n" );
#endif
if( tp->c_cflag & CRTSCTS )
printf( "\tCRTSCTS: harware flow control enabled?\n" );
else
printf( "\tCRTSCTS: hardware flow control disabled?\n" );
}
void print_c_cc( struct termios * tp )
{
int i;
char * cc_index_names [NCCS] = {
"[VINTR] ", /* 0 */
"[VQUIT] ", /* 1 */
"[VERASE] ", /* 2 */
"[VKILL] ", /* 3 */
"[VEOF] ", /* 4 */
"[VTIME] ", /* 5 */
"[VMIN] ", /* 6 */
"[VSWTC ", /* 7 */
"[VSTART] ", /* 8 */
"[VSTOP] ", /* 9 */
"[VSUSP] ", /* 10 */
"[VEOL] ", /* 11 */
"[VREPRINT]", /* 12 */
"[VDISCARD]", /* 13 */
"[VWERASE] ", /* 14 */
"[VLNEXT ", /* 15 */
"[VEOL2] ", /* 16 */
"unknown ", /* 17 */
"unknown ", /* 18 */
};
for( i = 0; i < NCCS; i++ ) {
printf( "c_cc%s = 0x%08x\n", cc_index_names[i], tp->c_cc[i] );
}
}
void print_termios( struct termios *tp )
{
printf( "\nLooking at the current termios settings:\n\n" );
print_c_iflag( tp );
print_c_oflag( tp );
print_c_cflag( tp );
print_c_lflag( tp );
print_c_cc( tp );
printf( "\n" );
}
unsigned long get_baud_rate( void )
{
unsigned long baud_rate;
while( TRUE ) {
printf( "Enter the numerical value for the new baud rate.\n" );
printf( "Choices are: 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800\n" );
printf( "2400, 4800, 9600, 19200, 38400, 57600, 115200, 230400, 460800\n" );
printf( "\nYour choice: " );
scanf( "%lu", &baud_rate );
printf( "\n" );
switch( baud_rate ) {
case 50: return B50;
case 75: return B75;
case 110: return B110;
case 134: return B134;
case 150: return B150;
case 200: return B200;
case 300: return B300;
case 600: return B600;
case 1200: return B1200;
case 1800: return B1800;
case 2400: return B2400;
case 4800: return B4800;
case 9600: return B9600;
case 19200: return B19200;
case 38400: return B38400;
case 57600: return B57600;
case 115200: return B115200;
case 230400: return B230400;
case 460800: return B460800;
default:
printf( "%lu is not a valid choice. Try again.\n\n", baud_rate );
break;
}
}
}
unsigned long get_parity()
{
int parity;
while( TRUE ) {
printf( "Enter the numerical value for the new parity\n" );
printf( "Choices are: 0 for no parity, 1 for even parity, 2 for odd parity\n" );
printf( "\nYour choice: " );
scanf( "%d", &parity );
printf( "\n" );
switch( parity ) {
case 0:
return 0;
case 1:
return PARENB;
case 2:
return PARENB | PARODD;
default:
printf( "%d is not a valid choice. Try again.\n\n", parity );
break;
}
}
}
unsigned long get_stop_bits()
{
int stop_bits;
while( TRUE ) {
printf( "Enter the numerical value for the new number of stop bits\n" );
printf( "Choices are: 1 or 2\n" );
printf( "\nYour choice: " );
scanf( "%d", &stop_bits );
printf( "\n" );
switch( stop_bits ) {
case 1:
return 0;
case 2:
return CSTOPB;
default:
printf( "%d is not a valid choice. Try again.\n\n", stop_bits );
break;
}
}
}
unsigned long get_data_bits()
{
int data_bits;
while( TRUE ) {
printf( "Enter the numerical value for the new number of data bits\n" );
printf( "Choices are: 5, 6, 7 or 8\n" );
printf( "\nYour choice: " );
scanf( "%d", &data_bits );
printf( "\n" );
switch( data_bits ) {
case 5:
return CS5;
case 6:
return CS6;
case 7:
return CS7;
case 8:
return CS8;
default:
printf( "%d is not a valid choice. Try again.\n\n", data_bits );
break;
}
}
}
void change_line_settings( struct termios *tp )
{
unsigned long baud_rate, parity, stop_bits, data_bits, sleep_time;
printf( "\nSetting line characteristics\n\n" );
baud_rate = get_baud_rate();
parity = get_parity();
stop_bits = get_stop_bits();
data_bits = get_data_bits();
printf( "NOTE: You will not see output until you switch your terminal settings!\n" );
printf( "WARNING: If you do not switch your terminal settings, your terminal may hang.\n" );
printf( "Enter the number of seconds the test will wait for you to switch your terminal\n" );
printf( "settings before it continues\n" );
printf( "Sleep time (in seconds): " );
scanf( "%lu", &sleep_time );
printf( "\n" );
printf( "Setting line to new termios settings in %lu seconds.\n", sleep_time );
sleep( sleep_time );
tp->c_cflag = CLOCAL | CREAD | parity | stop_bits | data_bits | baud_rate;
if( tcsetattr( fileno( stdin ), TCSADRAIN, tp ) < 0 ) {
perror( "change_line_settings(): tcsetattr() failed" );
rtems_test_exit( 1 );
}
printf( "Line settings set.\n" );
}
void canonical_input( struct termios *tp )
{
char c, first_time = TRUE;
printf( "\nTesting canonical input\n\n" );
printf( "Setting line to canonical input mode.\n" );
tp->c_lflag = ISIG | ICANON | ECHO | ECHONL | ECHOK | ECHOE | ECHOPRT | ECHOCTL | IEXTEN;
tp->c_iflag = BRKINT | ICRNL | IXON | IMAXBEL;
if( tcsetattr( fileno( stdin ), TCSADRAIN, tp ) < 0 ) {
perror( "canonical_input(): tcsetattr() failed" );
rtems_test_exit( 1 );
}
while ( ( c = getchar () ) != '\n');
printf( "Testing getchar(). Type some text followed by carriage return\n" );
printf( "Each character you entered will be echoed back to you\n\n" );
while ( ( c = getchar () ) != '\n') {
if( first_time ) {
printf( "\nYou typed:\n");
first_time = FALSE;
}
printf( "%c", c );
}
printf( "\n\nCanonical input test done.\n" );
}
/*
* Test raw (ICANON=0) input
*/
void do_raw_input( int vmin, int vtime )
{
int i;
struct termios old, new;
rtems_interval ticksPerSecond, then, now;
unsigned int msec;
unsigned long count;
int nread;
unsigned char cbuf[100];
printf( "Raw input test with VMIN=%d VTIME=%d\n", vmin, vtime );
rtems_clock_get( RTEMS_CLOCK_GET_TICKS_PER_SECOND, &ticksPerSecond );
if ( tcgetattr( fileno ( stdin ), &old ) < 0 ) {
perror( "do_raw_input(): tcgetattr() failed" );
return;
}
new = old;
new.c_lflag &= ~( ICANON | ECHO | ECHONL | ECHOK | ECHOE | ECHOPRT | ECHOCTL );
new.c_cc[VMIN] = vmin;
new.c_cc[VTIME] = vtime;
if( tcsetattr( fileno( stdin ), TCSADRAIN, &new ) < 0 ) {
perror ("do_raw_input(): tcsetattr() failed" );
return;
}
do {
rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &then );
count = 0;
for(;;) {
nread = read( fileno( stdin ), cbuf, sizeof cbuf );
if( nread < 0 ) {
perror( "do_raw_input(): read() failed" );
goto out;
}
count++;
if( nread != 0 )
break;
}
rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &now );
msec = (now - then) * 1000 / ticksPerSecond;
printf( "Count:%-10lu Interval:%3u.%3.3d Char:",
count, msec / 1000, msec % 1000 );
for( i = 0 ; i < nread ; i++ )
printf (" 0x%2.2x", cbuf[i]);
printf ("\n");
} while( cbuf[0] != 'q' );
out:
if( tcsetattr( fileno( stdin ), TCSADRAIN, &old) < 0 )
perror("do_raw_input(): tcsetattr() failed: %s\n" );
printf ("*** End of Raw input VMIN=%d VTIME=%d ***\n", vmin, vtime);
}
static void raw_input( struct termios *tp )
{
printf( "\nTesting raw input input\n\n" );
printf( "Hit 'q' to terminate the test\n" );
do_raw_input( 0, 0 );
do_raw_input( 0, 20 );
do_raw_input( 5, 0 );
do_raw_input( 5, 20 );
printf( "\nRaw input test done.\n" );
}
void usage( void )
{
printf( "\nYou have the following choices:\n" );
printf( " 1 - Reset the struct termios\n" );
printf( " 2 - Look at the current termios setting\n" );
printf( " 3 - Change the line characteristics\n" );
printf( " 4 - Test canonical input\n" );
printf( " 5 - Test raw input\n" );
printf( " 9 - Exit\n" );
printf( "Enter your choice (1 to 5 or 9, followed by a carriage return): " );
}
/*
* RTEMS Startup Task
*/
rtems_task
Init (rtems_task_argument ignored)
{
char c ;
struct termios orig_termios, test_termios;
printf( "\n\n*** TEST OF TERMIOS INPUT CAPABILITIES ***\n" );
if( tcgetattr( fileno( stdin ), &orig_termios ) < 0 ) {
perror( "tcgetattr() failed" );
rtems_test_exit( 0 );
}
test_termios = orig_termios;
usage();
for(;;) {
switch( c = getchar() ) {
case '1':
printf( "\nResetting the line to the original termios setting\n\n" );
test_termios = orig_termios;
if( tcsetattr( fileno( stdin ), TCSADRAIN, &test_termios ) < 0 ) {
perror( "tcsetattr() failed" );
rtems_test_exit( 1 );
}
usage();
break;
case '2':
print_termios( &test_termios );
usage();
break;
case '3':
change_line_settings( &test_termios );
usage();
break;
case '4':
canonical_input( &test_termios );
usage();
break;
case '5':
raw_input( &test_termios );
usage();
break;
case '9':
rtems_test_exit( 1 );
case '\n':
break;
default:
printf( "\n%c is not a valid choice. Try again\n\n", c );
usage();
break;
}
}
}