From 352c9b2035e32e56f10f261d94955d97f4ab0f1c Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Tue, 9 Nov 1999 22:07:23 +0000 Subject: This patch adds the basic framework for the ITRON 3.0 API implementation for RTEMS. --- c/src/tests/tmitrontests/tmitronsem01/Makefile.in | 73 +++++++++++ c/src/tests/tmitrontests/tmitronsem01/init.c | 141 +++++++++++++++++++++ c/src/tests/tmitrontests/tmitronsem01/system.h | 39 ++++++ .../tmitrontests/tmitronsem01/tmitronsem01.doc | 9 ++ 4 files changed, 262 insertions(+) create mode 100644 c/src/tests/tmitrontests/tmitronsem01/Makefile.in create mode 100644 c/src/tests/tmitrontests/tmitronsem01/init.c create mode 100644 c/src/tests/tmitrontests/tmitronsem01/system.h create mode 100644 c/src/tests/tmitrontests/tmitronsem01/tmitronsem01.doc (limited to 'c/src/tests/tmitrontests/tmitronsem01') diff --git a/c/src/tests/tmitrontests/tmitronsem01/Makefile.in b/c/src/tests/tmitrontests/tmitronsem01/Makefile.in new file mode 100644 index 0000000000..8777928c69 --- /dev/null +++ b/c/src/tests/tmitrontests/tmitronsem01/Makefile.in @@ -0,0 +1,73 @@ +# +# $Id$ +# + +@SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +top_builddir = .. +subdir = tmitronsem01 + +RTEMS_ROOT = @RTEMS_ROOT@ +PROJECT_ROOT = @PROJECT_ROOT@ + +VPATH = @srcdir@ + +TEST = tmitronsem01 + +MANAGERS = all + +# C source names, if any, go here -- minus the .c +C_PIECES = init +C_FILES = $(C_PIECES:%=%.c) +C_O_FILES = $(C_PIECES:%=${ARCH}/%.o) + +H_FILES = system.h + +DOCTYPES = doc +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 += -I$(srcdir)/../include +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/tmitrontests/tmitronsem01/init.c b/c/src/tests/tmitrontests/tmitronsem01/init.c new file mode 100644 index 0000000000..396d45d04b --- /dev/null +++ b/c/src/tests/tmitrontests/tmitronsem01/init.c @@ -0,0 +1,141 @@ +/* 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 +#include + +void ITRON_Init( void ) +{ + T_CSEM pk_csem; + T_RSEM pk_rsem; + int index; + + pk_csem.isemcnt = 2; + pk_csem.maxsem = 3; + pk_csem.sematr = TA_TFIFO; + + printf( "\n\n*** TMITRON01 -- ITRON TIMING TEST ***\n" ); + + /* + * time one invocation of cre_sem + */ + + Timer_initialize(); + (void) cre_sem( 1, &pk_csem ); + end_time = Read_timer(); + put_time( + "cre_sem", + end_time, + 1, + 0, /* no loop overhead to take out */ + 0 /* no calling overhead */ + ); + + /* + * time one invocation of del_sem + */ + + Timer_initialize(); + (void) del_sem( 1 ); + end_time = Read_timer(); + put_time( + "del_sem", + end_time, + 1, + 0, /* no loop overhead to take out */ + 0 /* no calling overhead */ + ); + + pk_csem.isemcnt = 100; + pk_csem.maxsem = 100; + pk_csem.sematr = TA_TFIFO; + (void) cre_sem( 1, &pk_csem ); + + /* + * time preq_sem (available) + */ + + Timer_initialize(); + for ( index = 1 ; index<=OPERATION_COUNT ; index++ ) + (void) preq_sem( 1 ); + end_time = Read_timer(); + put_time( + "preq_sem (available)", + end_time, + OPERATION_COUNT, + 0, /* don't take the loop overhead out */ + 0 /* no calling overhead */ + ); + + /* + * time preq_sem (not available) + */ + + Timer_initialize(); + for ( index = 1 ; index<=OPERATION_COUNT ; index++ ) + (void) preq_sem( 1 ); + end_time = Read_timer(); + put_time( + "preq_sem (not available)", + end_time, + OPERATION_COUNT, + 0, /* don't take the loop overhead out */ + 0 /* no calling overhead */ + ); + + /* + * time sig_sem (no waiting tasks) + */ + + Timer_initialize(); + for ( index = 1 ; index<=OPERATION_COUNT ; index++ ) + (void) sig_sem( 1 ); + end_time = Read_timer(); + put_time( + "sig_sem (no waiting tasks)", + end_time, + OPERATION_COUNT, + 0, /* don't take the loop overhead out */ + 0 /* no calling overhead */ + ); + + /* + * time ref_sem + */ + + Timer_initialize(); + for ( index = 1 ; index<=OPERATION_COUNT ; index++ ) + (void) ref_sem( 1, &pk_rsem ); + end_time = Read_timer(); + put_time( + "ref_sem", + end_time, + OPERATION_COUNT, + 0, /* don't take the loop overhead out */ + 0 /* no calling overhead */ + ); + + printf( "\n\nXXX ADD BLOCKING AND PREEMPTING TIME TESTS\n\n" ); + + + printf( "*** END OF TMITRON01 -- ITRON TIMING TEST ***\n" ); + exit( 0 ); +} diff --git a/c/src/tests/tmitrontests/tmitronsem01/system.h b/c/src/tests/tmitrontests/tmitronsem01/system.h new file mode 100644 index 0000000000..0537ae527a --- /dev/null +++ b/c/src/tests/tmitrontests/tmitronsem01/system.h @@ -0,0 +1,39 @@ +/* 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 +#include +#include + +/* functions */ + +void ITRON_Init( void ); + +/* configuration information */ + +#define CONFIGURE_TEST_NEEDS_TIMER_DRIVER +#define CONFIGURE_TEST_NEEDS_CONSOLE_DRIVER + +#define CONFIGURE_ITRON_INIT_TASK_TABLE +#define CONFIGURE_MAXIMUM_ITRON_SEMAPHORES 100 + +#include + +/* global variables */ + +TEST_EXTERN rtems_id Global_variable; /* example global variable */ + +/* end of include file */ diff --git a/c/src/tests/tmitrontests/tmitronsem01/tmitronsem01.doc b/c/src/tests/tmitrontests/tmitronsem01/tmitronsem01.doc new file mode 100644 index 0000000000..558f0594c8 --- /dev/null +++ b/c/src/tests/tmitrontests/tmitronsem01/tmitronsem01.doc @@ -0,0 +1,9 @@ +# +# $Id$ +# +# 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. +# + +Time some basic ITRON semaphore operations -- cgit v1.2.3