diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 1999-11-09 23:27:05 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 1999-11-09 23:27:05 +0000 |
commit | e0991809991a2c5547d45881978212d5efc0e1de (patch) | |
tree | 3f88b84781cec14fee64157792b9f6adf8abf758 /c/src/tests/itrontests/itrontask01 | |
parent | Added nesting count for suspend/resume. (diff) | |
download | rtems-e0991809991a2c5547d45881978212d5efc0e1de.tar.bz2 |
Merged tests from Task group.
Diffstat (limited to 'c/src/tests/itrontests/itrontask01')
-rw-r--r-- | c/src/tests/itrontests/itrontask01/Makefile.in | 74 | ||||
-rw-r--r-- | c/src/tests/itrontests/itrontask01/init.c | 62 | ||||
-rw-r--r-- | c/src/tests/itrontests/itrontask01/itrontask01.doc | 60 | ||||
-rw-r--r-- | c/src/tests/itrontests/itrontask01/itrontask01.scn | 16 | ||||
-rw-r--r-- | c/src/tests/itrontests/itrontask01/system.h | 9 | ||||
-rw-r--r-- | c/src/tests/itrontests/itrontask01/task1.c | 55 |
6 files changed, 238 insertions, 38 deletions
diff --git a/c/src/tests/itrontests/itrontask01/Makefile.in b/c/src/tests/itrontests/itrontask01/Makefile.in new file mode 100644 index 0000000000..765b3e9925 --- /dev/null +++ b/c/src/tests/itrontests/itrontask01/Makefile.in @@ -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 diff --git a/c/src/tests/itrontests/itrontask01/init.c b/c/src/tests/itrontests/itrontask01/init.c index 3b36e2e9ec..62525bf578 100644 --- a/c/src/tests/itrontests/itrontask01/init.c +++ b/c/src/tests/itrontests/itrontask01/init.c @@ -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" ); } diff --git a/c/src/tests/itrontests/itrontask01/itrontask01.doc b/c/src/tests/itrontests/itrontask01/itrontask01.doc new file mode 100644 index 0000000000..2ae309239f --- /dev/null +++ b/c/src/tests/itrontests/itrontask01/itrontask01.doc @@ -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. + + + + + + + diff --git a/c/src/tests/itrontests/itrontask01/itrontask01.scn b/c/src/tests/itrontests/itrontask01/itrontask01.scn new file mode 100644 index 0000000000..735b8e14cc --- /dev/null +++ b/c/src/tests/itrontests/itrontask01/itrontask01.scn @@ -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 *** diff --git a/c/src/tests/itrontests/itrontask01/system.h b/c/src/tests/itrontests/itrontask01/system.h index 8a5b4ad378..7523bb5890 100644 --- a/c/src/tests/itrontests/itrontask01/system.h +++ b/c/src/tests/itrontests/itrontask01/system.h @@ -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 */ + + + diff --git a/c/src/tests/itrontests/itrontask01/task1.c b/c/src/tests/itrontests/itrontask01/task1.c new file mode 100644 index 0000000000..2df961c35c --- /dev/null +++ b/c/src/tests/itrontests/itrontask01/task1.c @@ -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" ); + } +} + |