forked from Imagelibrary/rtems
Merged tests from Task group.
This commit is contained in:
13
c/src/tests/itrontests/itronhello/itronhello.doc
Normal file
13
c/src/tests/itrontests/itronhello/itronhello.doc
Normal file
@@ -0,0 +1,13 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# COPYRIGHT (c) 1989-1998.
|
||||
# On-Line Applications Research Corporation (OAR).
|
||||
# Copyright assigned to U.S. Government, 1994.
|
||||
#
|
||||
# The license and distribution terms for this file may be
|
||||
# found in the file LICENSE in this distribution or at
|
||||
# http://www.OARcorp.com/rtems/license.html.
|
||||
#
|
||||
|
||||
|
||||
3
c/src/tests/itrontests/itronhello/itronhello.scn
Normal file
3
c/src/tests/itrontests/itronhello/itronhello.scn
Normal file
@@ -0,0 +1,3 @@
|
||||
*** HELLO WORLD TEST ***
|
||||
Hello World
|
||||
*** END OF HELLO WORLD TEST ***
|
||||
13
c/src/tests/itrontests/itronmbf01/itronmbf01.doc
Normal file
13
c/src/tests/itrontests/itronmbf01/itronmbf01.doc
Normal file
@@ -0,0 +1,13 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# COPYRIGHT (c) 1989-1998.
|
||||
# On-Line Applications Research Corporation (OAR).
|
||||
# Copyright assigned to U.S. Government, 1994.
|
||||
#
|
||||
# The license and distribution terms for this file may be
|
||||
# found in the file LICENSE in this distribution or at
|
||||
# http://www.OARcorp.com/rtems/license.html.
|
||||
#
|
||||
|
||||
|
||||
3
c/src/tests/itrontests/itronmbf01/itronmbf01.scn
Normal file
3
c/src/tests/itrontests/itronmbf01/itronmbf01.scn
Normal file
@@ -0,0 +1,3 @@
|
||||
*** HELLO WORLD TEST ***
|
||||
Hello World
|
||||
*** END OF HELLO WORLD TEST ***
|
||||
13
c/src/tests/itrontests/itronsem01/itronsem01.doc
Normal file
13
c/src/tests/itrontests/itronsem01/itronsem01.doc
Normal file
@@ -0,0 +1,13 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# COPYRIGHT (c) 1989-1998.
|
||||
# On-Line Applications Research Corporation (OAR).
|
||||
# Copyright assigned to U.S. Government, 1994.
|
||||
#
|
||||
# The license and distribution terms for this file may be
|
||||
# found in the file LICENSE in this distribution or at
|
||||
# http://www.OARcorp.com/rtems/license.html.
|
||||
#
|
||||
|
||||
|
||||
3
c/src/tests/itrontests/itronsem01/itronsem01.scn
Normal file
3
c/src/tests/itrontests/itronsem01/itronsem01.scn
Normal file
@@ -0,0 +1,3 @@
|
||||
*** HELLO WORLD TEST ***
|
||||
Hello World
|
||||
*** END OF HELLO WORLD TEST ***
|
||||
74
c/src/tests/itrontests/itrontask01/Makefile.in
Normal file
74
c/src/tests/itrontests/itrontask01/Makefile.in
Normal file
@@ -0,0 +1,74 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
@SET_MAKE@
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
top_builddir = ..
|
||||
subdir = itrontask01
|
||||
|
||||
RTEMS_ROOT = @RTEMS_ROOT@
|
||||
PROJECT_ROOT = @PROJECT_ROOT@
|
||||
|
||||
VPATH = @srcdir@
|
||||
|
||||
TEST = itrontask01
|
||||
PGM = ${ARCH}/$(TEST).exe
|
||||
|
||||
MANAGERS = all
|
||||
|
||||
# C source names, if any, go here -- minus the .c
|
||||
C_PIECES = init task1
|
||||
C_FILES = $(C_PIECES:%=%.c)
|
||||
C_O_FILES = $(C_PIECES:%=${ARCH}/%.o)
|
||||
|
||||
H_FILES = system.h
|
||||
|
||||
DOCTYPES = doc 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 $(RTEMS_ROOT)/make/leaf.cfg
|
||||
|
||||
INSTALL_CHANGE = @INSTALL_CHANGE@
|
||||
PACKHEX = @PACKHEX@
|
||||
|
||||
#
|
||||
# (OPTIONAL) Add local stuff here using +=
|
||||
#
|
||||
|
||||
DEFINES +=
|
||||
CPPFLAGS +=
|
||||
CFLAGS +=
|
||||
|
||||
LD_PATHS +=
|
||||
LD_LIBS +=
|
||||
LDFLAGS +=
|
||||
|
||||
#
|
||||
# Add your list of files to delete here. The config files
|
||||
# already know how to delete some stuff, so you may want
|
||||
# to just run 'make clean' first to see what gets missed.
|
||||
# 'make clobber' already includes 'make clean'
|
||||
#
|
||||
|
||||
CLEAN_ADDITIONS +=
|
||||
CLOBBER_ADDITIONS +=
|
||||
|
||||
all: ${ARCH} $(SRCS) $(PGM)
|
||||
@$(INSTALL_VARIANT) -m 755 ${PGM} $(PROJECT_RELEASE)/tests
|
||||
|
||||
${PGM}: $(OBJS) $(LINK_FILES)
|
||||
$(make-exe)
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
@@ -1,19 +1,15 @@
|
||||
/* Init
|
||||
*
|
||||
* This routine is the initialization task for this test program.
|
||||
* It is a user initialization task and has the responsibility for creating
|
||||
* It is called from init_exec 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. This test is based off of sp01.
|
||||
* value by this function.
|
||||
*
|
||||
* Input parameters: NONE
|
||||
*
|
||||
* Output parameters: NONE
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1998.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
@@ -21,52 +17,52 @@
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
|
||||
#define TEST_INIT
|
||||
#include "system.h"
|
||||
|
||||
#warning "Task_id is really an rtems_id"
|
||||
void Task_1_through_3( void ){}
|
||||
#include <stdio.h>
|
||||
|
||||
void ITRON_Init( void )
|
||||
{
|
||||
rtems_time_of_day time;
|
||||
ER status;
|
||||
T_CTSK values;
|
||||
T_CTSK pk_ctsk;
|
||||
|
||||
puts( "\n\n*** ITRONTASK01 - TICKER TEST ***" );
|
||||
puts( "\n\n*** ITRON TEST 3 ***" );
|
||||
|
||||
/*
|
||||
* XXX - Change this to an itron clock !!
|
||||
*/
|
||||
|
||||
build_time( &time, 12, 31, 1988, 9, 0, 0, 0 );
|
||||
status = rtems_clock_set( &time );
|
||||
directive_failed( status, "rtems_clock_set" );
|
||||
|
||||
values.exinf = NULL;
|
||||
values.tskatr = TA_HLNG;
|
||||
values.task = Task_1_through_3;
|
||||
values.itskpri = 1;
|
||||
values.stksz = RTEMS_MINIMUM_STACK_SIZE;
|
||||
pk_ctsk.exinf = NULL;
|
||||
pk_ctsk.tskatr = TA_HLNG;
|
||||
pk_ctsk.itskpri = 1;
|
||||
pk_ctsk.task = Task_2_through_4;
|
||||
|
||||
status = cre_tsk( Task_id[1], &values );
|
||||
pk_ctsk.stksz = RTEMS_MINIMUM_STACK_SIZE;
|
||||
status = cre_tsk( 2, &pk_ctsk );
|
||||
directive_failed( status, "cre_tsk of TA1" );
|
||||
|
||||
values.stksz = RTEMS_MINIMUM_STACK_SIZE;
|
||||
status = cre_tsk( Task_id[2], &values );
|
||||
directive_failed( status, "cre_tsk of TA1" );
|
||||
pk_ctsk.stksz = RTEMS_MINIMUM_STACK_SIZE * 2;
|
||||
status = cre_tsk( 3, &pk_ctsk );
|
||||
directive_failed( status, "cre_tsk of TA2" );
|
||||
|
||||
values.stksz = RTEMS_MINIMUM_STACK_SIZE;
|
||||
status = cre_tsk( Task_id[3], &values );
|
||||
directive_failed( status, "cre_tsk of TA1" );
|
||||
pk_ctsk.stksz = RTEMS_MINIMUM_STACK_SIZE * 3;
|
||||
status = cre_tsk( 4, &pk_ctsk );
|
||||
directive_failed( status, "cre_tsk of TA3" );
|
||||
|
||||
#if 0
|
||||
status = sta_tsk( Task_id[1] );
|
||||
directive_failed( status, "rtems_task_start of TA1" );
|
||||
status = sta_tsk( 2, 0 );
|
||||
directive_failed( status, "sta_tsk of TA1" );
|
||||
|
||||
directive_failed( status, "rtems_task_start of TA2" );
|
||||
status = sta_tsk( 3, 0 );
|
||||
directive_failed( status, "sta_tsk of TA1" );
|
||||
|
||||
status = rtems_task_start( Task_id[ 3 ], Task_1_through_3, 0 );
|
||||
directive_failed( status, "rtems_task_start of TA3" );
|
||||
status = sta_tsk( 4, 0 );
|
||||
directive_failed( status, "sta_tsk of TA1" );
|
||||
|
||||
status = rtems_task_delete( RTEMS_SELF );
|
||||
directive_failed( status, "rtems_task_delete of RTEMS_SELF" );
|
||||
#endif
|
||||
exd_tsk();
|
||||
directive_failed( 0, "exd_tsk" );
|
||||
}
|
||||
|
||||
60
c/src/tests/itrontests/itrontask01/itrontask01.doc
Normal file
60
c/src/tests/itrontests/itrontask01/itrontask01.doc
Normal file
@@ -0,0 +1,60 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# COPYRIGHT (c) 1989-1998.
|
||||
# On-Line Applications Research Corporation (OAR).
|
||||
# Copyright assigned to U.S. Government, 1994.
|
||||
#
|
||||
# The license and distribution terms for this file may be
|
||||
# found in the file LICENSE in this distribution or at
|
||||
# http://www.OARcorp.com/rtems/license.html.
|
||||
#
|
||||
|
||||
This file describes the directives and concepts tested by this test set.
|
||||
This test is based upon the test in sp01.
|
||||
|
||||
test set name: test1
|
||||
|
||||
directives:
|
||||
cre_tsk, sta_tsk, exd_tsk, get_tid
|
||||
ex_init, ex_start, t_create, t_start, tm_tick, i_return, t_ident,
|
||||
tm_set, tm_get, tm_wkafter
|
||||
|
||||
concepts: XXX verify
|
||||
|
||||
a. Verifies system can create and start both the executive's system
|
||||
initialization and idle task.
|
||||
|
||||
b. Verifies executive can swap between three application tasks at the
|
||||
same priority and the executive's internal idle task.
|
||||
|
||||
c. Verifies can print strings to the CRT on port 2 of the mvme136 board
|
||||
using Print and Println in the board support package.
|
||||
|
||||
d. Verifies interrupt handler can handle a task switch from an interrupt
|
||||
as specified with the i_return directive.
|
||||
|
||||
e. Verifies executive initialization performed correctly.
|
||||
|
||||
f. Verifies the executive trap handler except for the halt function.
|
||||
|
||||
g. Verifies that a task can get the task identification number of itself.
|
||||
|
||||
notes:
|
||||
|
||||
rtems clock directives should change to itron clock directives when
|
||||
the clock directives are merged.
|
||||
|
||||
change rtems task wake after to itron routines.
|
||||
|
||||
output:
|
||||
"TA1" is printed once every 5 seconds.
|
||||
"TA2" is printed once every 10 seconds.
|
||||
"TA3" is printed once every 15 seconds.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
16
c/src/tests/itrontests/itrontask01/itrontask01.scn
Normal file
16
c/src/tests/itrontests/itrontask01/itrontask01.scn
Normal file
@@ -0,0 +1,16 @@
|
||||
*** ITRON TEST 3 ***
|
||||
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
|
||||
TA2 - rtems_clock_get - 09:00:10 12/31/1988
|
||||
TA1 - rtems_clock_get - 09:00:10 12/31/1988
|
||||
TA3 - rtems_clock_get - 09:00:15 12/31/1988
|
||||
TA1 - rtems_clock_get - 09:00:15 12/31/1988
|
||||
TA2 - rtems_clock_get - 09:00:20 12/31/1988
|
||||
TA1 - rtems_clock_get - 09:00:20 12/31/1988
|
||||
TA1 - rtems_clock_get - 09:00:25 12/31/1988
|
||||
TA3 - rtems_clock_get - 09:00:30 12/31/1988
|
||||
TA2 - rtems_clock_get - 09:00:30 12/31/1988
|
||||
TA1 - rtems_clock_get - 09:00:30 12/31/1988
|
||||
*** END OF ITRON TEST 3 ***
|
||||
@@ -15,11 +15,11 @@
|
||||
*/
|
||||
|
||||
#include <tmacros.h>
|
||||
#include <itron.h>
|
||||
|
||||
/* functions */
|
||||
|
||||
void ITRON_Init( void );
|
||||
void Task_2_through_4();
|
||||
|
||||
/* configuration information */
|
||||
|
||||
@@ -28,12 +28,11 @@ void ITRON_Init( void );
|
||||
|
||||
#define CONFIGURE_ITRON_INIT_TASK_TABLE
|
||||
|
||||
#define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE)
|
||||
|
||||
#include <confdefs.h>
|
||||
|
||||
/* global variables */
|
||||
|
||||
TEST_EXTERN rtems_id Task_id[ 4 ]; /* array of task ids */
|
||||
|
||||
/* end of include file */
|
||||
|
||||
|
||||
|
||||
|
||||
55
c/src/tests/itrontests/itrontask01/task1.c
Normal file
55
c/src/tests/itrontests/itrontask01/task1.c
Normal file
@@ -0,0 +1,55 @@
|
||||
/* Task_1_through_3
|
||||
*
|
||||
* This routine serves as a test task. It verifies the basic task
|
||||
* switching capabilities of the executive.
|
||||
*
|
||||
* Input parameters:
|
||||
* argument - task argument
|
||||
*
|
||||
* Output parameters: NONE
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1998.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include "system.h"
|
||||
|
||||
void Task_2_through_4()
|
||||
{
|
||||
ID tid;
|
||||
int tid_index;
|
||||
rtems_time_of_day time;
|
||||
ER status;
|
||||
char name[30];
|
||||
|
||||
status = get_tid( &tid );
|
||||
directive_failed( status, "get_tid");
|
||||
|
||||
tid_index = tid - 1; /* account for init tasks */
|
||||
|
||||
sprintf(name, "TA%d", tid_index);
|
||||
|
||||
while( FOREVER ) {
|
||||
status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time );
|
||||
directive_failed( status, "rtems_clock_get" );
|
||||
|
||||
if ( time.second >= 35 ) {
|
||||
puts( "*** END OF ITRON TEST 3 ***" );
|
||||
exit( 0 );
|
||||
}
|
||||
|
||||
printf(name);
|
||||
print_time( " - rtems_clock_get - ", &time, "\n" );
|
||||
|
||||
status = rtems_task_wake_after( tid_index * 5 * TICKS_PER_SECOND );
|
||||
directive_failed( status, "rtems_task_wake_after" );
|
||||
}
|
||||
}
|
||||
|
||||
74
c/src/tests/itrontests/itrontask02/Makefile.in
Normal file
74
c/src/tests/itrontests/itrontask02/Makefile.in
Normal file
@@ -0,0 +1,74 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
@SET_MAKE@
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
top_builddir = ..
|
||||
subdir = itrontask02
|
||||
|
||||
RTEMS_ROOT = @RTEMS_ROOT@
|
||||
PROJECT_ROOT = @PROJECT_ROOT@
|
||||
|
||||
VPATH = @srcdir@
|
||||
|
||||
TEST = itrontask02
|
||||
PGM = ${ARCH}/$(TEST).exe
|
||||
|
||||
MANAGERS = all
|
||||
|
||||
# C source names, if any, go here -- minus the .c
|
||||
C_PIECES = init preempt
|
||||
C_FILES = $(C_PIECES:%=%.c)
|
||||
C_O_FILES = $(C_PIECES:%=${ARCH}/%.o)
|
||||
|
||||
H_FILES = system.h
|
||||
|
||||
DOCTYPES = doc 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 $(RTEMS_ROOT)/make/leaf.cfg
|
||||
|
||||
INSTALL_CHANGE = @INSTALL_CHANGE@
|
||||
PACKHEX = @PACKHEX@
|
||||
|
||||
#
|
||||
# (OPTIONAL) Add local stuff here using +=
|
||||
#
|
||||
|
||||
DEFINES +=
|
||||
CPPFLAGS +=
|
||||
CFLAGS +=
|
||||
|
||||
LD_PATHS +=
|
||||
LD_LIBS +=
|
||||
LDFLAGS +=
|
||||
|
||||
#
|
||||
# Add your list of files to delete here. The config files
|
||||
# already know how to delete some stuff, so you may want
|
||||
# to just run 'make clean' first to see what gets missed.
|
||||
# 'make clobber' already includes 'make clean'
|
||||
#
|
||||
|
||||
CLEAN_ADDITIONS +=
|
||||
CLOBBER_ADDITIONS +=
|
||||
|
||||
all: ${ARCH} $(SRCS) $(PGM)
|
||||
@$(INSTALL_VARIANT) -m 755 ${PGM} $(PROJECT_RELEASE)/tests
|
||||
|
||||
${PGM}: $(OBJS) $(LINK_FILES)
|
||||
$(make-exe)
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
518
c/src/tests/itrontests/itrontask02/init.c
Normal file
518
c/src/tests/itrontests/itrontask02/init.c
Normal file
@@ -0,0 +1,518 @@
|
||||
/* Init
|
||||
*
|
||||
* This routine is the initialization task for this test program.
|
||||
* It is called from init_exec 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: NONE
|
||||
*
|
||||
* Output parameters: NONE
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#define TEST_INIT
|
||||
#include "system.h"
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
void ITRON_Init( void )
|
||||
{
|
||||
|
||||
/*
|
||||
* Status Codes for these errors
|
||||
*
|
||||
*
|
||||
* E_OK - Normal Completion
|
||||
*
|
||||
* E_NOMEM - Insufficient memory (Memory for control block and/or user
|
||||
* stack cannot be allocated)
|
||||
*
|
||||
* E_ID - Invalid ID Number (tskid was invalid or could not be used)
|
||||
*
|
||||
* E_RSATR - Reserved attribute (tskatr was invalid or could not be used)
|
||||
*
|
||||
* E_OBJ - Invalid object state (a task of the same ID already exists)
|
||||
*
|
||||
* E_OACV - Object access violation (A tskid less than -4 was specified
|
||||
* from a user task. This is implementation dependent.)
|
||||
*
|
||||
* E_PAR - Parameter error (pk_ctsk, task, itskpri and/or stksz is invalid)
|
||||
*
|
||||
* E_NOEXS - Object does not exist (the task specified by tskid does not
|
||||
* exist)
|
||||
*
|
||||
* E_CTX - Context error (issued from task-independent portions or a task
|
||||
* in dispatch disabled state)
|
||||
*
|
||||
*
|
||||
*
|
||||
* Network Specific Errors (ITRON calls these Connection Function Errors)
|
||||
*
|
||||
* EN_OBJNO - An object number which could not be accessed on the target
|
||||
* node is specified.
|
||||
*
|
||||
* EN_CTXID - Specified an object on another node when the system call
|
||||
* was issued from a task in dispatch disabled state or from
|
||||
* a task-independent portion
|
||||
*
|
||||
* EN_PAR - A value outside the range supported by the target node and/or
|
||||
* transmission packet format was specified as a parameter
|
||||
* (a value outside supported range was specified for exinf,
|
||||
* tskatr, task, itskpri and/or stksz)
|
||||
*
|
||||
* EN_RPAR - A value outside the range supported by the requesting node
|
||||
* and/or transmission packet format was returned as a return
|
||||
* parameter (a value outside supported range was returned for
|
||||
* exinf, tskpri and/or tskstat)
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
rtems_time_of_day time;
|
||||
ER status;
|
||||
T_CTSK pk_ctsk;
|
||||
T_RTSK pk_rtsk; /* Reference Task Packet */
|
||||
|
||||
|
||||
puts( "\n\n*** ITRON04 -- ITRON TASK TEST 4 ***\n" );
|
||||
puts( "\n*** Create Task Errors ***" );
|
||||
|
||||
build_time( &time, 12, 31, 1988, 9, 0, 0, 0 );
|
||||
status = rtems_clock_set( &time );
|
||||
directive_failed( status, "rtems_clock_set" );
|
||||
|
||||
pk_ctsk.exinf = NULL;
|
||||
pk_ctsk.tskatr = TA_HLNG;
|
||||
pk_ctsk.itskpri = 1;
|
||||
pk_ctsk.task = Preempt_task;
|
||||
pk_ctsk.stksz = RTEMS_MINIMUM_STACK_SIZE;
|
||||
|
||||
puts( "Init - cre_tsk - Preempt Task" );
|
||||
status = cre_tsk( PREEMPT_TASK_ID, &pk_ctsk );
|
||||
assert( status == E_OK );
|
||||
|
||||
/*
|
||||
* Bad ID errors
|
||||
*/
|
||||
|
||||
puts( "Init - cre_tsk - access violation ( id less than -4) - E_OACV" );
|
||||
status = cre_tsk( -5, &pk_ctsk );
|
||||
assert( status == E_OACV );
|
||||
|
||||
puts( "Init - cre_tsk - bad id (between 0 and -4) - E_ID" );
|
||||
status = cre_tsk( -2, &pk_ctsk );
|
||||
assert( status == E_ID );
|
||||
|
||||
puts( "Init - cre_tsk - cannot create self (0) - E_ID" );
|
||||
status = cre_tsk( 0, &pk_ctsk );
|
||||
assert( status == E_ID );
|
||||
|
||||
puts( "Init - cre_tsk - invalid id; id already exists - E_OBJ" );
|
||||
status = cre_tsk( 1, &pk_ctsk );
|
||||
assert( status == E_OBJ );
|
||||
|
||||
/*
|
||||
* Bad task attribute errors
|
||||
*/
|
||||
|
||||
pk_ctsk.tskatr = -1;
|
||||
puts( "Init - cre_tsk - tskatr is invalid - E_RSATR" );
|
||||
status = cre_tsk( 5, &pk_ctsk );
|
||||
assert( status == E_RSATR );
|
||||
|
||||
puts( "Init - cre_tsk - pk_ctsk is invalid - E_PAR" );
|
||||
status = cre_tsk( 5, NULL );
|
||||
assert( status == E_PAR );
|
||||
|
||||
pk_ctsk.tskatr = TA_HLNG;
|
||||
pk_ctsk.itskpri = 0;
|
||||
puts( "Init - cre_tsk - itskpri is invalid - E_PAR" );
|
||||
status = cre_tsk( 5, &pk_ctsk );
|
||||
assert( status == E_PAR );
|
||||
|
||||
pk_ctsk.stksz = -1;
|
||||
puts( "Init - cre_tsk - stksz is invalid - E_PAR" );
|
||||
status = cre_tsk( 5, &pk_ctsk );
|
||||
assert( status == E_PAR );
|
||||
|
||||
pk_ctsk.task = NULL;
|
||||
puts( "Init - cre_tsk - task is invalid - E_PAR" );
|
||||
status = cre_tsk( 5, &pk_ctsk );
|
||||
assert( status == E_PAR );
|
||||
|
||||
|
||||
#if (0)
|
||||
/* these errors can not be generated for cre_tsk at this time */
|
||||
assert( status == E_NOMEM );
|
||||
assert( status == EN_OBJNO );
|
||||
assert( status == EN_CTXID );
|
||||
assert( status == EN_PAR );
|
||||
#endif
|
||||
|
||||
|
||||
puts( "\n\n*** Delete Task Errors ***" );
|
||||
|
||||
/*
|
||||
* Reset structure
|
||||
*/
|
||||
|
||||
pk_ctsk.exinf = NULL;
|
||||
pk_ctsk.tskatr = TA_HLNG;
|
||||
pk_ctsk.itskpri = 1;
|
||||
pk_ctsk.task = Preempt_task;
|
||||
pk_ctsk.stksz = RTEMS_MINIMUM_STACK_SIZE;
|
||||
|
||||
|
||||
puts( "Init - del_tsk - cannot delete self - E_OBJ" );
|
||||
status = del_tsk( 1 );
|
||||
assert( status == E_OBJ );
|
||||
|
||||
puts( "Init - del_tsk - task is not DORMANT - E_OBJ" );
|
||||
status = del_tsk( 1 );
|
||||
assert( status == E_OBJ );
|
||||
|
||||
puts( "Init - del_tsk - task does not exist - E_NOEXS" );
|
||||
status = del_tsk( 5 );
|
||||
assert( status == E_NOEXS );
|
||||
|
||||
puts( "Init - del_tsk - access violation ( id less than -4) - E_OACV" );
|
||||
status = del_tsk( -5 );
|
||||
assert( status == E_OACV );
|
||||
|
||||
puts( "Init - del_tsk - cannot delete SELF - E_OBJ" );
|
||||
status = del_tsk( 0 );
|
||||
assert( status == E_OBJ );
|
||||
|
||||
puts( "Init - del_tsk - bad id (between 0 and -4) - E_ID" );
|
||||
status = del_tsk( -3 );
|
||||
assert( status == E_ID );
|
||||
|
||||
#if (0)
|
||||
/* these errors can not be generated for del_tsk at this time */
|
||||
assert( status == EN_OBJNO );
|
||||
assert( status == EN_CTXID );
|
||||
#endif
|
||||
|
||||
|
||||
puts( "\n\n*** Start Task Errors ***" );
|
||||
|
||||
puts( "Init - sta_tsk - access violation ( id less than -4) - E_OACV" );
|
||||
status = sta_tsk( -5, 1 );
|
||||
assert( status == E_OACV );
|
||||
|
||||
puts( "Init - sta_tsk - bad id (between 0 and -4) - E_ID" );
|
||||
status = sta_tsk( -2, 1 );
|
||||
assert( status == E_ID );
|
||||
|
||||
puts( "Init - sta_tsk - cannot start SELF - E_OBJ" );
|
||||
status = sta_tsk( 0, 1 );
|
||||
assert( status == E_OBJ );
|
||||
|
||||
puts( "Init - sta_tsk - task is not DORMANT - E_OBJ" );
|
||||
status = sta_tsk( 1, 1 );
|
||||
assert( status == E_OBJ );
|
||||
|
||||
puts( "Init - sta_tsk - task does not exist - E_NOEXS" );
|
||||
status = sta_tsk( 5, 1 );
|
||||
assert( status == E_NOEXS );
|
||||
|
||||
#if (0)
|
||||
/* these errors can not be generated for sta_tsk at this time */
|
||||
assert( status == EN_OBJNO );
|
||||
assert( status == EN_CTXID );
|
||||
assert( status == EN_PAR );
|
||||
#endif
|
||||
|
||||
|
||||
#if (0)
|
||||
/* these errors can not be tested at this time */
|
||||
puts( "\n\n*** Exit Task Errors ***" );
|
||||
puts( "Init - ext_tsk - context error - E_CTX" );
|
||||
status = ext_tsk( );
|
||||
assert( status == E_CTX );
|
||||
|
||||
puts( "\n\n*** Exit and Delete Task Errors ***" );
|
||||
puts( "Init - exd_tsk - context error - E_CTX" );
|
||||
status = exd_tsk( );
|
||||
assert( status == E_CTX );
|
||||
#endif
|
||||
|
||||
|
||||
puts( "\n\n*** Terminate Other Task Errors ***" );
|
||||
|
||||
puts( "Init - ter_tsk - bad id (between 0 and -4) - E_ID" );
|
||||
status = ter_tsk( -2 );
|
||||
assert( status == E_ID );
|
||||
|
||||
puts( "Init - ter_tsk - cannot terminate SELF (0) - E_OBJ" );
|
||||
status = ter_tsk( 0 );
|
||||
assert( status == E_OBJ );
|
||||
|
||||
puts( "Init - ter_tsk - task is not DORMANT - E_OBJ" );
|
||||
status = ter_tsk( 1 );
|
||||
assert( status == E_OBJ );
|
||||
|
||||
puts( "Init - ter_tsk - task does not exist - E_NOEXS" );
|
||||
status = ter_tsk( 5 );
|
||||
assert( status == E_NOEXS );
|
||||
|
||||
puts( "Init - ter_tsk - access violation ( id less than -4) - E_OACV" );
|
||||
status = ter_tsk( -5 );
|
||||
assert( status == E_OACV );
|
||||
|
||||
#if (0)
|
||||
/* these errors can not be generated for ter_tsk at this time */
|
||||
assert( status == EN_OBJNO );
|
||||
assert( status == EN_CTXID );
|
||||
#endif
|
||||
|
||||
|
||||
#if (0)
|
||||
status = dis_dsp( );
|
||||
assert( status == E_CTX );
|
||||
|
||||
status = ena_dsp( );
|
||||
assert( status == E_CTX );
|
||||
#endif
|
||||
|
||||
|
||||
puts( "\n\n*** Change Priority Task Errors ***" );
|
||||
|
||||
puts( "Init - chg_pri - bad id (between 0 and -4) - E_ID" );
|
||||
status = chg_pri( -2, 1 );
|
||||
assert( status == E_ID );
|
||||
|
||||
/* Call from task independent portion to cause E_OBJ
|
||||
puts( "Init - chg_pri - change priority of SELF - E_OBJ" );
|
||||
status = chg_pri( 0, 1 );
|
||||
assert( status == E_OBJ );
|
||||
*/
|
||||
|
||||
/* Need a dormant task to call
|
||||
puts( "Init - chg_pri - task is not DORMANT - E_OBJ" );
|
||||
status = chg_pri( 1, 1 );
|
||||
assert( status == E_OBJ );
|
||||
*/
|
||||
|
||||
puts( "Init - chg_pri - task does not exist - E_NOEXS" );
|
||||
status = chg_pri( 5, 1 );
|
||||
assert( status == E_NOEXS );
|
||||
|
||||
puts( "Init - chg_pri - access violation ( id less than -4) - E_OACV" );
|
||||
status = chg_pri( -5, 1 );
|
||||
assert( status == E_OACV );
|
||||
|
||||
puts( "Init - chg_pri - invalid priority - E_PAR" );
|
||||
status = chg_pri( 1, -1 );
|
||||
assert( status == E_PAR );
|
||||
|
||||
#if (0)
|
||||
/* these errors can not be generated for chg_pri at this time */
|
||||
assert( status == EN_OBJNO );
|
||||
assert( status == EN_CTXID );
|
||||
assert( status == EN_PAR );
|
||||
#endif
|
||||
|
||||
/* This gave me a nasty-gram
|
||||
* "core_find_mapping() - access to unmaped address, attach a default map
|
||||
* to handle this - addr=0x80002098 nr_bytes=0x4 processor=0x40134008
|
||||
* cia=0xc744"
|
||||
*/
|
||||
|
||||
puts( "\n\n*** Rotate Ready Queue Errors ***" );
|
||||
puts( "Init - rot_rdq - invalid priority - E_PAR" );
|
||||
status = rot_rdq( -1 );
|
||||
assert( status == E_PAR );
|
||||
|
||||
#if (0)
|
||||
/* This routine is not coded */
|
||||
rel_wai( ID );
|
||||
assert( status == E_OK );
|
||||
assert( status == E_ID );
|
||||
assert( status == E_NOEXS );
|
||||
assert( status == E_OACV );
|
||||
assert( status == E_OBJ );
|
||||
assert( status == EN_OBJNO );
|
||||
assert( status == EN_CTXID );
|
||||
#endif
|
||||
|
||||
|
||||
#if (0)
|
||||
get_tid( ID );
|
||||
assert( status == E_OK );
|
||||
#endif
|
||||
|
||||
puts( "\n\n*** Reference Task Status Errors ***" );
|
||||
puts( "Init - ref_tsk - bad id (between 0 and -4) - E_ID" );
|
||||
status = ref_tsk( &pk_rtsk, -2 );
|
||||
assert( status == E_ID );
|
||||
|
||||
/* Call from task independent portion to cause E_ID
|
||||
puts( "Init - ref_tsk - reference SELF - E_ID" );
|
||||
status = ref_tsk( &pk_rtsk, 0 );
|
||||
assert( status == E_ID );
|
||||
*/
|
||||
|
||||
puts( "Init - ref_tsk - task does not exist - E_NOEXS" );
|
||||
status = ref_tsk( &pk_rtsk, 5 );
|
||||
assert( status == E_NOEXS );
|
||||
|
||||
puts( "Init - ref_tsk - access violation ( id less than -4) - E_OACV" );
|
||||
status = ref_tsk( &pk_rtsk, -5 );
|
||||
assert( status == E_OACV );
|
||||
|
||||
puts( "Init - ref_tsk - packet address is bad - E_PAR" );
|
||||
status = ref_tsk( NULL, 1 );
|
||||
assert( status == E_PAR );
|
||||
|
||||
|
||||
#if (0)
|
||||
/* these errors can not be generated for ref_tsk at this time */
|
||||
assert( status == EN_OBJNO );
|
||||
assert( status == EN_CTXID );
|
||||
assert( status == EN_RPAR );
|
||||
#endif
|
||||
|
||||
|
||||
puts( "\n\n*** Suspend Task Errors ***" );
|
||||
|
||||
puts( "Init - sus_tsk - access violation ( id less than -4) - E_OACV" );
|
||||
status = sus_tsk( -5 );
|
||||
assert( status == E_OACV );
|
||||
|
||||
puts( "Init - sus_tsk - bad id (between 0 and -4) - E_ID" );
|
||||
status = sus_tsk( -2 );
|
||||
assert( status == E_ID );
|
||||
|
||||
puts( "Init - sus_tsk - cannot suspend SELF - E_OBJ" );
|
||||
status = sus_tsk( 0 );
|
||||
assert( status == E_OBJ );
|
||||
|
||||
puts( "Init - sus_tsk - task does not exist - E_NOEXS" );
|
||||
status = sus_tsk( 5 );
|
||||
assert( status == E_NOEXS );
|
||||
#if (0)
|
||||
puts( "Init - sus_tsk - no support for nested SUSPENDS - E_QOVR" );
|
||||
status = sus_tsk( 1 );
|
||||
assert( status == E_QOVR );
|
||||
|
||||
puts( "Init - sus_tsk - exceeded limit for nested SUSPENDS - E_QOVR" );
|
||||
status = sus_tsk( 1 );
|
||||
assert( status == E_QOVR );
|
||||
#endif
|
||||
|
||||
#if (0)
|
||||
/* these errors can not be generated for sus_tsk at this time */
|
||||
assert( status == EN_OBJNO );
|
||||
assert( status == EN_CTXID );
|
||||
#endif
|
||||
|
||||
|
||||
puts( "\n\n*** Resume Task Errors ***" );
|
||||
|
||||
puts( "Init - rsm_tsk - access violation ( id less than -4) - E_OACV" );
|
||||
status = rsm_tsk( -5 );
|
||||
assert( status == E_OACV );
|
||||
|
||||
puts( "Init - rsm_tsk - bad id (between 0 and -4) - E_ID" );
|
||||
status = rsm_tsk( -2 );
|
||||
assert( status == E_ID );
|
||||
|
||||
puts( "Init - rsm_tsk - cannot resume SELF - E_OBJ" );
|
||||
status = rsm_tsk( 0 );
|
||||
assert( status == E_OBJ );
|
||||
|
||||
puts( "Init - rsm_tsk - task is DORMANT - E_OBJ" );
|
||||
status = rsm_tsk( 1 );
|
||||
assert( status == E_OBJ );
|
||||
|
||||
puts( "Init - rsm_tsk - task does not exist - E_NOEXS" );
|
||||
status = rsm_tsk( 5 );
|
||||
assert( status == E_NOEXS );
|
||||
|
||||
#if (0)
|
||||
/* these errors can not be generated for rsm_tsk at this time */
|
||||
assert( status == EN_OBJNO );
|
||||
assert( status == EN_CTXID );
|
||||
#endif
|
||||
|
||||
|
||||
puts( "\n\n*** Forcibly Resume Task Errors ***" );
|
||||
|
||||
puts( "Init - frsm_tsk - access violation ( id less than -4) - E_OACV" );
|
||||
status = frsm_tsk( -5 );
|
||||
assert( status == E_OACV );
|
||||
|
||||
puts( "Init - frsm_tsk - bad id (between 0 and -4) - E_ID" );
|
||||
status = frsm_tsk( -2 );
|
||||
assert( status == E_ID );
|
||||
|
||||
puts( "Init - frsm_tsk - cannot forcibly resume SELF - E_OBJ" );
|
||||
status = frsm_tsk( 0 );
|
||||
assert( status == E_OBJ );
|
||||
|
||||
puts( "Init - frsm_tsk - task is DORMANT - E_OBJ" );
|
||||
status = frsm_tsk( 1 );
|
||||
assert( status == E_OBJ );
|
||||
|
||||
puts( "Init - frsm_tsk - task does not exist - E_NOEXS" );
|
||||
status = frsm_tsk( 5 );
|
||||
assert( status == E_NOEXS );
|
||||
|
||||
#if (0)
|
||||
/* these errors can not be generated for frsm_tsk at this time */
|
||||
assert( status == EN_OBJNO );
|
||||
assert( status == EN_CTXID );
|
||||
#endif
|
||||
|
||||
|
||||
#if (0)
|
||||
/* these directives are not coded */
|
||||
slp_tsk( );
|
||||
assert( status == E_OK );
|
||||
assert( status == E_PAR );
|
||||
assert( status == E_RLWAI );
|
||||
assert( status == E_TMOUT );
|
||||
assert( status == E_CTX );
|
||||
|
||||
|
||||
tslp_tsk( TMO );
|
||||
assert( status == E_OK );
|
||||
assert( status == E_PAR );
|
||||
assert( status == E_RLWAI );
|
||||
assert( status == E_TMOUT );
|
||||
assert( status == E_CTX );
|
||||
|
||||
|
||||
wup_tsk( ID );
|
||||
assert( status == E_OK );
|
||||
assert( status == E_ID );
|
||||
assert( status == E_NOEXS );
|
||||
assert( status == E_OACV );
|
||||
assert( status == E_OBJ );
|
||||
assert( status == E_QOVR );
|
||||
assert( status == EN_OBJNO );
|
||||
assert( status == EN_CTXID );
|
||||
|
||||
|
||||
can_tsk( INT, ID );
|
||||
assert( status == E_OK );
|
||||
assert( status == E_ID );
|
||||
assert( status == E_NOEXS );
|
||||
assert( status == E_OACV );
|
||||
assert( status == E_OBJ );
|
||||
assert( status == EN_OBJNO );
|
||||
assert( status == EN_CTXID );
|
||||
assert( status == EN_RPAR );
|
||||
#endif
|
||||
|
||||
puts( "*** END OF ITRON TEST 4 ***" );
|
||||
exit( 0 );
|
||||
}
|
||||
21
c/src/tests/itrontests/itrontask02/itrontask02.doc
Normal file
21
c/src/tests/itrontests/itrontask02/itrontask02.doc
Normal file
@@ -0,0 +1,21 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# COPYRIGHT (c) 1989-1998.
|
||||
# On-Line Applications Research Corporation (OAR).
|
||||
# Copyright assigned to U.S. Government, 1994.
|
||||
#
|
||||
# The license and distribution terms for this file may be
|
||||
# found in the file LICENSE in this distribution or at
|
||||
# http://www.OARcorp.com/rtems/license.html.
|
||||
#
|
||||
|
||||
This file describes the directives and concepts tested by this test set.
|
||||
This test forces and verifies error conditions for the task and task
|
||||
synchronization managers..
|
||||
|
||||
test set name:
|
||||
|
||||
directives:
|
||||
|
||||
concepts:
|
||||
81
c/src/tests/itrontests/itrontask02/itrontask02.scn
Normal file
81
c/src/tests/itrontests/itrontask02/itrontask02.scn
Normal file
@@ -0,0 +1,81 @@
|
||||
*** ITRON04 -- ITRON TASK TEST 4 ***
|
||||
|
||||
|
||||
*** Create Task Errors ***
|
||||
Init - cre_tsk - Preempt Task
|
||||
Init - cre_tsk - access violation ( id less than -4) - E_OACV
|
||||
Init - cre_tsk - bad id (between 0 and -4) - E_ID
|
||||
Init - cre_tsk - cannot create self (0) - E_ID
|
||||
Init - cre_tsk - invalid id; id already exists - E_OBJ
|
||||
Init - cre_tsk - tskatr is invalid - E_RSATR
|
||||
Init - cre_tsk - pk_ctsk is invalid - E_PAR
|
||||
Init - cre_tsk - itskpri is invalid - E_PAR
|
||||
Init - cre_tsk - stksz is invalid - E_PAR
|
||||
Init - cre_tsk - task is invalid - E_PAR
|
||||
|
||||
|
||||
*** Delete Task Errors ***
|
||||
Init - del_tsk - cannot delete self - E_OBJ
|
||||
Init - del_tsk - task is not DORMANT - E_OBJ
|
||||
Init - del_tsk - task does not exist - E_NOEXS
|
||||
Init - del_tsk - access violation ( id less than -4) - E_OACV
|
||||
Init - del_tsk - cannot delete SELF - E_OBJ
|
||||
Init - del_tsk - bad id (between 0 and -4) - E_ID
|
||||
|
||||
|
||||
*** Start Task Errors ***
|
||||
Init - sta_tsk - access violation ( id less than -4) - E_OACV
|
||||
Init - sta_tsk - bad id (between 0 and -4) - E_ID
|
||||
Init - sta_tsk - cannot start SELF - E_OBJ
|
||||
Init - sta_tsk - task is not DORMANT - E_OBJ
|
||||
Init - sta_tsk - task does not exist - E_NOEXS
|
||||
|
||||
|
||||
*** Terminate Other Task Errors ***
|
||||
Init - ter_tsk - bad id (between 0 and -4) - E_ID
|
||||
Init - ter_tsk - cannot terminate SELF (0) - E_OBJ
|
||||
Init - ter_tsk - task is not DORMANT - E_OBJ
|
||||
Init - ter_tsk - task does not exist - E_NOEXS
|
||||
Init - ter_tsk - access violation ( id less than -4) - E_OACV
|
||||
|
||||
|
||||
*** Change Priority Task Errors ***
|
||||
Init - chg_pri - bad id (between 0 and -4) - E_ID
|
||||
Init - chg_pri - task does not exist - E_NOEXS
|
||||
Init - chg_pri - access violation ( id less than -4) - E_OACV
|
||||
Init - chg_pri - invalid priority - E_PAR
|
||||
|
||||
*** Rotate Ready Queue Errors ***
|
||||
Init - rot_rdq - invalid priority - E_PAR
|
||||
|
||||
|
||||
*** Reference Task Status Errors ***
|
||||
Init - ref_tsk - bad id (between 0 and -4) - E_ID
|
||||
Init - ref_tsk - task does not exist - E_NOEXS
|
||||
Init - ref_tsk - access violation ( id less than -4) - E_OACV
|
||||
Init - ref_tsk - packet address is bad - E_PAR
|
||||
|
||||
|
||||
*** Suspend Task Errors ***
|
||||
Init - sus_tsk - access violation ( id less than -4) - E_OACV
|
||||
Init - sus_tsk - bad id (between 0 and -4) - E_ID
|
||||
Init - sus_tsk - cannot suspend SELF - E_OBJ
|
||||
Init - sus_tsk - task does not exist - E_NOEXS
|
||||
|
||||
|
||||
*** Resume Task Errors ***
|
||||
Init - rsm_tsk - access violation ( id less than -4) - E_OACV
|
||||
Init - rsm_tsk - bad id (between 0 and -4) - E_ID
|
||||
Init - rsm_tsk - cannot resume SELF - E_OBJ
|
||||
Init - rsm_tsk - task is DORMANT - E_OBJ
|
||||
Init - rsm_tsk - task does not exist - E_NOEXS
|
||||
|
||||
|
||||
*** Forcibly Resume Task Errors ***
|
||||
Init - frsm_tsk - access violation ( id less than -4) - E_OACV
|
||||
Init - frsm_tsk - bad id (between 0 and -4) - E_ID
|
||||
Init - frsm_tsk - cannot forcibly resume SELF - E_OBJ
|
||||
Init - frsm_tsk - task is DORMANT - E_OBJ
|
||||
Init - frsm_tsk - task does not exist - E_NOEXS
|
||||
|
||||
*** END OF ITRON TEST 4 ***
|
||||
30
c/src/tests/itrontests/itrontask02/preempt.c
Normal file
30
c/src/tests/itrontests/itrontask02/preempt.c
Normal file
@@ -0,0 +1,30 @@
|
||||
/* Preempt_task
|
||||
*
|
||||
* This routine serves as a test task. It verifies the task manager.
|
||||
*
|
||||
* Input parameters:
|
||||
* argument - task argument
|
||||
*
|
||||
* Output parameters: NONE
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1998.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
#include <assert.h>
|
||||
#include "system.h"
|
||||
|
||||
void Preempt_task()
|
||||
{
|
||||
puts( "PREEMPT - ext_tsk - going to DORMANT state" );
|
||||
ext_tsk( );
|
||||
|
||||
puts( "ext_tsk of RTEMS_PREEMPT" );
|
||||
assert(0);
|
||||
}
|
||||
42
c/src/tests/itrontests/itrontask02/system.h
Normal file
42
c/src/tests/itrontests/itrontask02/system.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/* system.h
|
||||
*
|
||||
* This include file contains information that is included in every
|
||||
* function in the test set.
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1998.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <tmacros.h>
|
||||
|
||||
/* functions */
|
||||
|
||||
void ITRON_Init( void );
|
||||
void Preempt_task();
|
||||
|
||||
/* configuration information */
|
||||
|
||||
#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
|
||||
#define CONFIGURE_ITRON_INIT_TASK_TABLE
|
||||
|
||||
#include <confdefs.h>
|
||||
|
||||
/* global variables */
|
||||
|
||||
#define PREEMPT_TASK_ID 2
|
||||
|
||||
TEST_EXTERN rtems_id Global_variable; /* example global variable */
|
||||
|
||||
/* end of include file */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
74
c/src/tests/itrontests/itrontask03/Makefile.in
Normal file
74
c/src/tests/itrontests/itrontask03/Makefile.in
Normal file
@@ -0,0 +1,74 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
@SET_MAKE@
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
top_builddir = ..
|
||||
subdir = itrontask03
|
||||
|
||||
RTEMS_ROOT = @RTEMS_ROOT@
|
||||
PROJECT_ROOT = @PROJECT_ROOT@
|
||||
|
||||
VPATH = @srcdir@
|
||||
|
||||
TEST = itrontask03
|
||||
PGM = ${ARCH}/$(TEST).exe
|
||||
|
||||
MANAGERS = all
|
||||
|
||||
# C source names, if any, go here -- minus the .c
|
||||
C_PIECES = init preempt spinit task1 task2 task3
|
||||
C_FILES = $(C_PIECES:%=%.c)
|
||||
C_O_FILES = $(C_PIECES:%=${ARCH}/%.o)
|
||||
|
||||
H_FILES = system.h
|
||||
|
||||
DOCTYPES = doc 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 $(RTEMS_ROOT)/make/leaf.cfg
|
||||
|
||||
INSTALL_CHANGE = @INSTALL_CHANGE@
|
||||
PACKHEX = @PACKHEX@
|
||||
|
||||
#
|
||||
# (OPTIONAL) Add local stuff here using +=
|
||||
#
|
||||
|
||||
DEFINES +=
|
||||
CPPFLAGS +=
|
||||
CFLAGS +=
|
||||
|
||||
LD_PATHS +=
|
||||
LD_LIBS +=
|
||||
LDFLAGS +=
|
||||
|
||||
#
|
||||
# Add your list of files to delete here. The config files
|
||||
# already know how to delete some stuff, so you may want
|
||||
# to just run 'make clean' first to see what gets missed.
|
||||
# 'make clobber' already includes 'make clean'
|
||||
#
|
||||
|
||||
CLEAN_ADDITIONS +=
|
||||
CLOBBER_ADDITIONS +=
|
||||
|
||||
all: ${ARCH} $(SRCS) $(PGM)
|
||||
@$(INSTALL_VARIANT) -m 755 ${PGM} $(PROJECT_RELEASE)/tests
|
||||
|
||||
${PGM}: $(OBJS) $(LINK_FILES)
|
||||
$(make-exe)
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
94
c/src/tests/itrontests/itrontask03/init.c
Normal file
94
c/src/tests/itrontests/itrontask03/init.c
Normal file
@@ -0,0 +1,94 @@
|
||||
/* Init
|
||||
*
|
||||
* This routine is the initialization task for this test program.
|
||||
* It is called from init_exec 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: NONE
|
||||
*
|
||||
* Output parameters: NONE
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#define TEST_INIT
|
||||
#include "system.h"
|
||||
#include <stdio.h>
|
||||
|
||||
void ITRON_Init( void )
|
||||
{
|
||||
ER status;
|
||||
T_CTSK pk_ctsk;
|
||||
|
||||
puts( "\n\n*** ITRON TEST 5 ***" );
|
||||
|
||||
pk_ctsk.exinf = NULL;
|
||||
pk_ctsk.tskatr = TA_HLNG;
|
||||
pk_ctsk.stksz = RTEMS_MINIMUM_STACK_SIZE;
|
||||
|
||||
pk_ctsk.itskpri = 1;
|
||||
pk_ctsk.task = Preempt_task;
|
||||
status = cre_tsk( PREEMPT_TASK_ID, &pk_ctsk );
|
||||
directive_failed( status, "cre_tsk of RTEMS_PREEMPT" );
|
||||
status = sta_tsk( PREEMPT_TASK_ID, 0 );
|
||||
directive_failed( status, "sta_tsk of RTEMS_PREEMPT" );
|
||||
|
||||
puts( "INIT - rot_rdq - yielding processor" );
|
||||
status = rot_rdq( 1 );
|
||||
directive_failed( status, "rot_rdq" );
|
||||
|
||||
pk_ctsk.itskpri = 3;
|
||||
pk_ctsk.task = Task_1;
|
||||
status = cre_tsk( TA1_ID, &pk_ctsk );
|
||||
directive_failed( status, "cre_tsk of TA1" );
|
||||
|
||||
pk_ctsk.task = Task_2;
|
||||
status = cre_tsk( TA2_ID, &pk_ctsk );
|
||||
directive_failed( status, "cre_tsk of TA2" );
|
||||
|
||||
pk_ctsk.task = Task_3;
|
||||
status = cre_tsk( TA3_ID, &pk_ctsk );
|
||||
directive_failed( status, "cre_tsk of TA3" );
|
||||
|
||||
status = sta_tsk( TA1_ID, 0 );
|
||||
directive_failed( status, "sta_tsk of TA1" );
|
||||
status = sta_tsk( TA2_ID, 0 );
|
||||
directive_failed( status, "sta_tsk of TA2" );
|
||||
status = sta_tsk( TA3_ID, 0 );
|
||||
directive_failed( status, "sta_tsk of TA3" );
|
||||
|
||||
puts( "INIT - suspending TA2 while middle task on a ready chain" );
|
||||
status = sus_tsk( TA2_ID );
|
||||
directive_failed( status, "sus_tsk of TA2" );
|
||||
|
||||
status = ter_tsk( TA1_ID );
|
||||
directive_failed( status, "ter_tsk of TA1" );
|
||||
status = del_tsk( TA1_ID );
|
||||
directive_failed( status, "del_tsk of TA1" );
|
||||
status = ter_tsk( TA2_ID );
|
||||
directive_failed( status, "ter_tsk of TA2" );
|
||||
status = ter_tsk( TA3_ID );
|
||||
directive_failed( status, "ter_tsk of TA3" );
|
||||
|
||||
pk_ctsk.itskpri = 1;
|
||||
pk_ctsk.task = Task_1;
|
||||
status = cre_tsk( TA1_ID, &pk_ctsk );
|
||||
directive_failed( status, "cre_tsk of TA1 at priority 1" );
|
||||
|
||||
status = sta_tsk( TA1_ID, 0 );
|
||||
directive_failed( status, "sta_tsk of TA1" );
|
||||
status = sta_tsk( TA2_ID, 0 );
|
||||
directive_failed( status, "sta_tsk of TA2" );
|
||||
status = sta_tsk( TA3_ID, 0 );
|
||||
directive_failed( status, "sta_tsk of TA3" );
|
||||
|
||||
exd_tsk();
|
||||
directive_failed( 0, "exd_tsk" );
|
||||
}
|
||||
|
||||
40
c/src/tests/itrontests/itrontask03/itrontask03.doc
Normal file
40
c/src/tests/itrontests/itrontask03/itrontask03.doc
Normal file
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# COPYRIGHT (c) 1989-1998.
|
||||
# On-Line Applications Research Corporation (OAR).
|
||||
# Copyright assigned to U.S. Government, 1994.
|
||||
#
|
||||
# The license and distribution terms for this file may be
|
||||
# found in the file LICENSE in this distribution or at
|
||||
# http://www.OARcorp.com/rtems/license.html.
|
||||
#
|
||||
|
||||
|
||||
|
||||
This file describes the directives and concepts tested by this test set.
|
||||
|
||||
test set name: test2
|
||||
|
||||
directives:
|
||||
ext_tsk, cre_tsk, sta_tsk, rot_rdq
|
||||
|
||||
ex_start, t_create, t_start, tm_tick, i_return, t_ident,
|
||||
t_delete, tm_wkafter, t_setpri, t_suspend
|
||||
|
||||
concepts:
|
||||
|
||||
a. Verifies that a task can delete another task and also delete itself.
|
||||
|
||||
b. Verifies that memory is freed back to the heap correctly.
|
||||
|
||||
c. Verifies that TCBs are freed back to the inactive chain correctly.
|
||||
|
||||
d. Verifies that a task can get the task identification number of
|
||||
another task.
|
||||
|
||||
e. Verifies the _Set_state routine where the task is not READY.
|
||||
|
||||
f. Verifies the break statement in the _Block_activate routine.
|
||||
|
||||
g. Verifies the while loop in the _Prev_tcb routine.
|
||||
13
c/src/tests/itrontests/itrontask03/itrontask03.scn
Normal file
13
c/src/tests/itrontests/itrontask03/itrontask03.scn
Normal file
@@ -0,0 +1,13 @@
|
||||
*** ITRON TEST 5 ***
|
||||
INIT - rot_rdq - yielding processor
|
||||
PREEMPT - exd_tsk
|
||||
INIT - suspending TA2 while middle task on a ready chain
|
||||
TA1 - rtems_task_wake_after - sleep 1 second
|
||||
TA2 - rtems_task_wake_after - sleep 1 minute
|
||||
TA3 - rtems_task_wake_after - sleep 5 seconds
|
||||
TA1 - chg_pri - set TA3's priority to 2
|
||||
TA1 - rtems_task_suspend - suspend TA2
|
||||
TA1 - - delete TA2
|
||||
TA1 - rtems_task_wake_after - sleep for 5 seconds
|
||||
TA3 - exd_tsk - exit and delete self
|
||||
*** END OF TEST 5 ***
|
||||
31
c/src/tests/itrontests/itrontask03/preempt.c
Normal file
31
c/src/tests/itrontests/itrontask03/preempt.c
Normal file
@@ -0,0 +1,31 @@
|
||||
/* Preempt_task
|
||||
*
|
||||
* This routine serves as a test task. It verifies the task manager.
|
||||
*
|
||||
* Input parameters:
|
||||
* argument - task argument
|
||||
*
|
||||
* Output parameters: NONE
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1998.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include "system.h"
|
||||
|
||||
void Preempt_task()
|
||||
{
|
||||
ER status;
|
||||
|
||||
puts( "PREEMPT - exd_tsk" );
|
||||
exd_tsk( );
|
||||
assert( 0 );
|
||||
}
|
||||
152
c/src/tests/itrontests/itrontask03/spinit.c
Normal file
152
c/src/tests/itrontests/itrontask03/spinit.c
Normal file
@@ -0,0 +1,152 @@
|
||||
/* 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-1998.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#define TEST_INIT
|
||||
#include "system.h"
|
||||
|
||||
rtems_task Init(
|
||||
rtems_task_argument argument
|
||||
)
|
||||
{
|
||||
rtems_status_code status;
|
||||
|
||||
puts( "\n\n*** TEST 2 ***" );
|
||||
|
||||
Preempt_task_name = rtems_build_name( 'P', 'R', 'M', 'T' );
|
||||
|
||||
status = rtems_task_create(
|
||||
Preempt_task_name,
|
||||
1,
|
||||
RTEMS_MINIMUM_STACK_SIZE,
|
||||
RTEMS_DEFAULT_MODES,
|
||||
RTEMS_DEFAULT_ATTRIBUTES,
|
||||
&Preempt_task_id
|
||||
);
|
||||
directive_failed( status, "rtems_task_create of RTEMS_PREEMPT" );
|
||||
|
||||
status = rtems_task_start( Preempt_task_id, Preempt_task, 0 );
|
||||
directive_failed( status, "rtems_task_start of RTEMS_PREEMPT" );
|
||||
|
||||
puts( "INIT - rtems_task_wake_after - yielding processor" );
|
||||
status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
|
||||
directive_failed( status, "rtems_task_wake_after" );
|
||||
|
||||
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 ],
|
||||
3,
|
||||
RTEMS_MINIMUM_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 ],
|
||||
3,
|
||||
RTEMS_MINIMUM_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 ],
|
||||
3,
|
||||
RTEMS_MINIMUM_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, 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" );
|
||||
|
||||
puts( "INIT - suspending TA2 while middle task on a ready chain" );
|
||||
status = rtems_task_suspend( Task_id[ 2 ] );
|
||||
directive_failed( status, "rtems_task_suspend of TA2" );
|
||||
|
||||
status = rtems_task_delete( Task_id[ 1 ] );
|
||||
directive_failed( status, "rtems_task_delete of TA1" );
|
||||
|
||||
status = rtems_task_delete( Task_id[ 2 ] );
|
||||
directive_failed( status, "rtems_task_delete of TA2" );
|
||||
|
||||
status = rtems_task_delete( Task_id[ 3 ] );
|
||||
directive_failed( status, "rtems_task_delete of TA3" );
|
||||
|
||||
status = rtems_task_create(
|
||||
Task_name[ 1 ],
|
||||
1,
|
||||
RTEMS_MINIMUM_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 ],
|
||||
3,
|
||||
RTEMS_MINIMUM_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 ],
|
||||
3,
|
||||
RTEMS_MINIMUM_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, 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" );
|
||||
}
|
||||
44
c/src/tests/itrontests/itrontask03/system.h
Normal file
44
c/src/tests/itrontests/itrontask03/system.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/* system.h
|
||||
*
|
||||
* This include file contains information that is included in every
|
||||
* function in the test set.
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1998.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <tmacros.h>
|
||||
|
||||
/* functions */
|
||||
|
||||
void ITRON_Init( void );
|
||||
void Preempt_task();
|
||||
void Task_1();
|
||||
void Task_2();
|
||||
void Task_3();
|
||||
|
||||
/* configuration information */
|
||||
|
||||
#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
|
||||
#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
|
||||
#define CONFIGURE_ITRON_INIT_TASK_TABLE
|
||||
|
||||
#include <confdefs.h>
|
||||
|
||||
/* global variables */
|
||||
|
||||
#define PREEMPT_TASK_ID 2
|
||||
#define TA1_ID 3
|
||||
#define TA2_ID 4
|
||||
#define TA3_ID 5
|
||||
|
||||
TEST_EXTERN rtems_id Global_variable; /* example global variable */
|
||||
|
||||
/* end of include file */
|
||||
59
c/src/tests/itrontests/itrontask03/task1.c
Normal file
59
c/src/tests/itrontests/itrontask03/task1.c
Normal file
@@ -0,0 +1,59 @@
|
||||
/* Task_1
|
||||
*
|
||||
* This routine serves as a test task. It verifies the task manager.
|
||||
*
|
||||
* Input parameters:
|
||||
* argument - task argument
|
||||
*
|
||||
* Output parameters: NONE
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1998.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include "system.h"
|
||||
|
||||
void Task_1()
|
||||
{
|
||||
ER status;
|
||||
PRI previous_priority;
|
||||
|
||||
/*
|
||||
* XXX - Change to itron routine.
|
||||
*/
|
||||
|
||||
puts( "TA1 - rtems_task_wake_after - sleep 1 second" );
|
||||
status = rtems_task_wake_after( 1*TICKS_PER_SECOND );
|
||||
directive_failed( status, "rtems_task_wake_after" );
|
||||
|
||||
status = chg_pri( TA3_ID , 2 );
|
||||
directive_failed( status, "chg_pri" );
|
||||
|
||||
puts( "TA1 - chg_pri - set TA3's priority to 2" );
|
||||
|
||||
puts( "TA1 - rtems_task_suspend - suspend TA2" );
|
||||
status = sus_tsk( TA2_ID );
|
||||
directive_failed( status, "sus_tsk of TA2" );
|
||||
|
||||
puts( "TA1 - - delete TA2" );
|
||||
status = ter_tsk( TA2_ID );
|
||||
directive_failed( status, "ter_tsk of TA2" );
|
||||
|
||||
/*
|
||||
* XXX - Change to itron routine.
|
||||
*/
|
||||
|
||||
puts( "TA1 - rtems_task_wake_after - sleep for 5 seconds" );
|
||||
status = rtems_task_wake_after( 5*TICKS_PER_SECOND );
|
||||
directive_failed( status, "rtems_task_wake_after" );
|
||||
|
||||
puts( "*** END OF TEST 5 ***" );
|
||||
exit( 0 );
|
||||
}
|
||||
32
c/src/tests/itrontests/itrontask03/task2.c
Normal file
32
c/src/tests/itrontests/itrontask03/task2.c
Normal file
@@ -0,0 +1,32 @@
|
||||
/* Task_2
|
||||
*
|
||||
* This routine serves as a test task. It sleeps for 1 minute but
|
||||
* does not expect to wake up. Task 1 should suspend then delete it
|
||||
* so that it appears to never wake up.
|
||||
*
|
||||
* Input parameters:
|
||||
* argument - task argument
|
||||
*
|
||||
* Output parameters: NONE
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1998.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include "system.h"
|
||||
|
||||
void Task_2()
|
||||
{
|
||||
rtems_status_code status;
|
||||
|
||||
puts( "TA2 - rtems_task_wake_after - sleep 1 minute" );
|
||||
status = rtems_task_wake_after( 60*TICKS_PER_SECOND );
|
||||
directive_failed( status, "rtems_task_wake_after in TA2" );
|
||||
}
|
||||
40
c/src/tests/itrontests/itrontask03/task3.c
Normal file
40
c/src/tests/itrontests/itrontask03/task3.c
Normal file
@@ -0,0 +1,40 @@
|
||||
/* Task_3
|
||||
*
|
||||
* This routine serves as a test task. It simply sleeps for 5 seconds
|
||||
* and then deletes itself.
|
||||
*
|
||||
* Input parameters:
|
||||
* argument - task argument
|
||||
*
|
||||
* Output parameters: NONE
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1998.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include "system.h"
|
||||
|
||||
void Task_3()
|
||||
{
|
||||
rtems_status_code status;
|
||||
|
||||
/*
|
||||
* XXX - Convert Later.
|
||||
*/
|
||||
|
||||
puts( "TA3 - rtems_task_wake_after - sleep 5 seconds" );
|
||||
status = rtems_task_wake_after( 5*TICKS_PER_SECOND );
|
||||
directive_failed( status, "rtems_task_wake_after in TA3" );
|
||||
|
||||
|
||||
puts( "TA3 - exd_tsk - exit and delete self" );
|
||||
exd_tsk();
|
||||
directive_failed( 0, "exd_tsk" );
|
||||
}
|
||||
74
c/src/tests/itrontests/itrontask04/Makefile.in
Normal file
74
c/src/tests/itrontests/itrontask04/Makefile.in
Normal file
@@ -0,0 +1,74 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
|
||||
@SET_MAKE@
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
top_builddir = ..
|
||||
subdir = itrontask04
|
||||
|
||||
RTEMS_ROOT = @RTEMS_ROOT@
|
||||
PROJECT_ROOT = @PROJECT_ROOT@
|
||||
|
||||
VPATH = @srcdir@
|
||||
|
||||
TEST = itrontask04
|
||||
PGM = ${ARCH}/$(TEST).exe
|
||||
|
||||
MANAGERS = all
|
||||
|
||||
# C source names, if any, go here -- minus the .c
|
||||
C_PIECES = init task1 task2 task3
|
||||
C_FILES = $(C_PIECES:%=%.c)
|
||||
C_O_FILES = $(C_PIECES:%=${ARCH}/%.o)
|
||||
|
||||
H_FILES = system.h
|
||||
|
||||
DOCTYPES = doc 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 $(RTEMS_ROOT)/make/leaf.cfg
|
||||
|
||||
INSTALL_CHANGE = @INSTALL_CHANGE@
|
||||
PACKHEX = @PACKHEX@
|
||||
|
||||
#
|
||||
# (OPTIONAL) Add local stuff here using +=
|
||||
#
|
||||
|
||||
DEFINES +=
|
||||
CPPFLAGS +=
|
||||
CFLAGS +=
|
||||
|
||||
LD_PATHS +=
|
||||
LD_LIBS +=
|
||||
LDFLAGS +=
|
||||
|
||||
#
|
||||
# Add your list of files to delete here. The config files
|
||||
# already know how to delete some stuff, so you may want
|
||||
# to just run 'make clean' first to see what gets missed.
|
||||
# 'make clobber' already includes 'make clean'
|
||||
#
|
||||
|
||||
CLEAN_ADDITIONS +=
|
||||
CLOBBER_ADDITIONS +=
|
||||
|
||||
all: ${ARCH} $(SRCS) $(PGM)
|
||||
@$(INSTALL_VARIANT) -m 755 ${PGM} $(PROJECT_RELEASE)/tests
|
||||
|
||||
${PGM}: $(OBJS) $(LINK_FILES)
|
||||
$(make-exe)
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
85
c/src/tests/itrontests/itrontask04/init.c
Normal file
85
c/src/tests/itrontests/itrontask04/init.c
Normal file
@@ -0,0 +1,85 @@
|
||||
/* Init
|
||||
*
|
||||
* This routine is the initialization task for this test program.
|
||||
* It is called from init_exec 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: NONE
|
||||
*
|
||||
* Output parameters: NONE
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#define TEST_INIT
|
||||
#include "system.h"
|
||||
#include <stdio.h>
|
||||
|
||||
void ITRON_Init( void )
|
||||
{
|
||||
ER status;
|
||||
T_CTSK pk_ctsk;
|
||||
|
||||
puts( "\n\n*** ITRON TEST 6 ***" );
|
||||
|
||||
status = chg_pri( 0, 20 );
|
||||
directive_failed( status, "chg_pri to 20" );
|
||||
|
||||
pk_ctsk.exinf = NULL;
|
||||
pk_ctsk.tskatr = TA_HLNG;
|
||||
pk_ctsk.stksz = RTEMS_MINIMUM_STACK_SIZE;
|
||||
pk_ctsk.itskpri = 2;
|
||||
|
||||
pk_ctsk.task = Task_1;
|
||||
status = cre_tsk( TA1_ID, &pk_ctsk );
|
||||
directive_failed( status, "cre_tsk of TA1" );
|
||||
|
||||
pk_ctsk.task = Task_2;
|
||||
status = cre_tsk( TA2_ID, &pk_ctsk );
|
||||
directive_failed( status, "cre_tsk of TA2" );
|
||||
|
||||
pk_ctsk.itskpri = 1;
|
||||
pk_ctsk.task = Task_3;
|
||||
status = cre_tsk( TA3_ID, &pk_ctsk );
|
||||
directive_failed( status, "cre_tsk of TA3" );
|
||||
|
||||
puts("INIT - dis_dsp while starting tasks");
|
||||
status = dis_dsp( );
|
||||
directive_failed( status, "dis_dsp from ITRON_Init" );
|
||||
status = sta_tsk( TA1_ID, 0 );
|
||||
directive_failed( status, "sta_tsk of TA1" );
|
||||
status = sta_tsk( TA2_ID, 0 );
|
||||
directive_failed( status, "sta_tsk of TA2" );
|
||||
status = sta_tsk( TA3_ID, 0 );
|
||||
directive_failed( status, "sta_tsk of TA3" );
|
||||
|
||||
puts( "INIT - suspending TA2 3 times" );
|
||||
status = sus_tsk( TA2_ID );
|
||||
directive_failed( status, "sus_tsk of TA2" );
|
||||
status = sus_tsk( TA2_ID );
|
||||
directive_failed( status, "sus_tsk of TA2" );
|
||||
status = sus_tsk( TA2_ID );
|
||||
directive_failed( status, "sus_tsk of TA2" );
|
||||
|
||||
puts("INIT - ena_dsp while starting tasks");
|
||||
status = ena_dsp( );
|
||||
|
||||
puts( "INIT - suspending TA1 3 times" );
|
||||
status = sus_tsk( TA1_ID );
|
||||
directive_failed( status, "sus_tsk of TA2" );
|
||||
status = sus_tsk( TA1_ID );
|
||||
directive_failed( status, "sus_tsk of TA2" );
|
||||
status = sus_tsk( TA1_ID );
|
||||
directive_failed( status, "sus_tsk of TA2" );
|
||||
|
||||
puts("INIT - exd_tsk");
|
||||
exd_tsk();
|
||||
directive_failed( 0, "exd_tsk" );
|
||||
}
|
||||
|
||||
23
c/src/tests/itrontests/itrontask04/itrontask04.doc
Normal file
23
c/src/tests/itrontests/itrontask04/itrontask04.doc
Normal file
@@ -0,0 +1,23 @@
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# COPYRIGHT (c) 1989-1998.
|
||||
# On-Line Applications Research Corporation (OAR).
|
||||
# Copyright assigned to U.S. Government, 1994.
|
||||
#
|
||||
# The license and distribution terms for this file may be
|
||||
# found in the file LICENSE in this distribution or at
|
||||
# http://www.OARcorp.com/rtems/license.html.
|
||||
#
|
||||
|
||||
This file describes the directives and concepts tested by this test set.
|
||||
|
||||
test set name: 2
|
||||
This test check task suspend and resume functionality.
|
||||
|
||||
directives:
|
||||
|
||||
concepts:
|
||||
|
||||
a.
|
||||
|
||||
35
c/src/tests/itrontests/itrontask04/itrontask04.scn
Normal file
35
c/src/tests/itrontests/itrontask04/itrontask04.scn
Normal file
@@ -0,0 +1,35 @@
|
||||
*** ITRON TEST 6 ***
|
||||
INIT - dis_dsp while starting tasks
|
||||
INIT - suspending TA2 3 times
|
||||
INIT - ena_dsp while starting tasks
|
||||
TA3 - frsm_tsk TA1
|
||||
TA3 - rsm_tsk TA2
|
||||
TA3 - rot_rdq priority 2 queue
|
||||
TA3 - rtems_task_wake_after - sleep 1 second
|
||||
TA2 - rtems_task_suspend RTEMS_SELF
|
||||
INIT - suspending TA1 3 times
|
||||
INIT - exd_tsk
|
||||
TA3 - frsm_tsk TA1
|
||||
TA3 - rsm_tsk TA2
|
||||
TA3 - rot_rdq priority 2 queue
|
||||
TA3 - rtems_task_wake_after - sleep 1 second
|
||||
TA2 - rtems_task_suspend RTEMS_SELF
|
||||
TA3 - frsm_tsk TA1
|
||||
TA3 - rsm_tsk TA2
|
||||
TA3 - rot_rdq priority 2 queue
|
||||
TA3 - rtems_task_wake_after - sleep 1 second
|
||||
TA2 - rtems_task_suspend RTEMS_SELF
|
||||
TA2 - rtems_task_suspend RTEMS_SELF
|
||||
TA3 - frsm_tsk TA1
|
||||
TA3 - rsm_tsk TA2
|
||||
TA3 - rot_rdq priority 2 queue
|
||||
TA3 - rtems_task_wake_after - sleep 1 second
|
||||
TA2 - rtems_task_suspend RTEMS_SELF
|
||||
TA2 - rtems_task_suspend RTEMS_SELF
|
||||
TA3 - frsm_tsk TA1
|
||||
TA3 - rsm_tsk TA2
|
||||
TA3 - rot_rdq priority 2 queue
|
||||
TA3 - rtems_task_wake_after - sleep 1 second
|
||||
TA2 - rtems_task_suspend RTEMS_SELF
|
||||
TA2 - rtems_task_suspend RTEMS_SELF
|
||||
*** END OF TEST 6 ***
|
||||
44
c/src/tests/itrontests/itrontask04/system.h
Normal file
44
c/src/tests/itrontests/itrontask04/system.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/* system.h
|
||||
*
|
||||
* This include file contains information that is included in every
|
||||
* function in the test set.
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1998.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <tmacros.h>
|
||||
|
||||
/* functions */
|
||||
|
||||
void ITRON_Init( void );
|
||||
void Preempt_task();
|
||||
void Task_1();
|
||||
void Task_2();
|
||||
void Task_3();
|
||||
|
||||
/* configuration information */
|
||||
|
||||
#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER
|
||||
#define CONFIGURE_TEST_NEEDS_CLOCK_DRIVER
|
||||
#define CONFIGURE_ITRON_INIT_TASK_TABLE
|
||||
|
||||
#include <confdefs.h>
|
||||
|
||||
/* global variables */
|
||||
|
||||
#define PREEMPT_TASK_ID 2
|
||||
#define TA1_ID 3
|
||||
#define TA2_ID 4
|
||||
#define TA3_ID 5
|
||||
|
||||
TEST_EXTERN rtems_id Global_variable; /* example global variable */
|
||||
|
||||
/* end of include file */
|
||||
45
c/src/tests/itrontests/itrontask04/task1.c
Normal file
45
c/src/tests/itrontests/itrontask04/task1.c
Normal file
@@ -0,0 +1,45 @@
|
||||
/* Task_1
|
||||
*
|
||||
* This routine serves as a test task. It verifies the task manager.
|
||||
*
|
||||
* Input parameters:
|
||||
* argument - task argument
|
||||
*
|
||||
* Output parameters: NONE
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1998.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include "system.h"
|
||||
|
||||
/*
|
||||
* XXX - This test requires tasks to suspend self, yet ITRON defines
|
||||
* this as an error.
|
||||
*/
|
||||
|
||||
void Task_1()
|
||||
{
|
||||
rtems_status_code status;
|
||||
|
||||
while (1) {
|
||||
|
||||
puts( "TA2 - rtems_task_suspend RTEMS_SELF" );
|
||||
status = rtems_task_suspend( RTEMS_SELF );
|
||||
directive_failed( status, "TA2 rtems_task_suspend RTEMS_SELF" );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
41
c/src/tests/itrontests/itrontask04/task2.c
Normal file
41
c/src/tests/itrontests/itrontask04/task2.c
Normal file
@@ -0,0 +1,41 @@
|
||||
/* Task_2
|
||||
*
|
||||
* This routine serves as a test task. It sleeps for 1 minute but
|
||||
* does not expect to wake up. Task 1 should suspend then delete it
|
||||
* so that it appears to never wake up.
|
||||
*
|
||||
* Input parameters:
|
||||
* argument - task argument
|
||||
*
|
||||
* Output parameters: NONE
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1998.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include "system.h"
|
||||
|
||||
/*
|
||||
* XXX - This test requires tasks to suspend self, yet ITRON defines
|
||||
* this as an error.
|
||||
*/
|
||||
|
||||
void Task_2()
|
||||
{
|
||||
rtems_status_code status;
|
||||
|
||||
while (1) {
|
||||
|
||||
puts( "TA2 - rtems_task_suspend RTEMS_SELF" );
|
||||
status = rtems_task_suspend( RTEMS_SELF );
|
||||
directive_failed( status, "TA2 rtems_task_suspend RTEMS_SELF" );
|
||||
|
||||
}
|
||||
}
|
||||
53
c/src/tests/itrontests/itrontask04/task3.c
Normal file
53
c/src/tests/itrontests/itrontask04/task3.c
Normal file
@@ -0,0 +1,53 @@
|
||||
/* Task_3
|
||||
*
|
||||
* This routine serves as a test task. It simply sleeps for 5 seconds
|
||||
* and then deletes itself.
|
||||
*
|
||||
* Input parameters:
|
||||
* argument - task argument
|
||||
*
|
||||
* Output parameters: NONE
|
||||
*
|
||||
* COPYRIGHT (c) 1989-1998.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright assigned to U.S. Government, 1994.
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
* http://www.OARcorp.com/rtems/license.html.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include "system.h"
|
||||
|
||||
void Task_3()
|
||||
{
|
||||
rtems_status_code status;
|
||||
int i;
|
||||
|
||||
for(i=0; i<5; i++) {
|
||||
puts("TA3 - frsm_tsk TA1");
|
||||
status = frsm_tsk( TA1_ID );
|
||||
directive_failed( status, "TA3 - frsm_tsk TA1" );
|
||||
|
||||
puts("TA3 - rsm_tsk TA2");
|
||||
status = rsm_tsk( TA2_ID );
|
||||
directive_failed( status, "TA3 - rsm_tsk TA2" );
|
||||
|
||||
puts( "TA3 - rot_rdq priority 2 queue");
|
||||
status = rot_rdq( 2 );
|
||||
directive_failed( status, "rot_rdq for 2" );
|
||||
|
||||
/*
|
||||
* XXX - Convert Later.
|
||||
*/
|
||||
|
||||
puts( "TA3 - rtems_task_wake_after - sleep 1 second" );
|
||||
status = rtems_task_wake_after( TICKS_PER_SECOND );
|
||||
directive_failed( status, "rtems_task_wake_after in TA3" );
|
||||
}
|
||||
|
||||
puts( "*** END OF TEST 6 ***" );
|
||||
exit( 0 );
|
||||
}
|
||||
Reference in New Issue
Block a user