diff options
Diffstat (limited to 'ticker/ticker')
-rw-r--r-- | ticker/ticker/.cvsignore | 1 | ||||
-rw-r--r-- | ticker/ticker/Makefile | 27 | ||||
-rw-r--r-- | ticker/ticker/init.c | 107 |
3 files changed, 135 insertions, 0 deletions
diff --git a/ticker/ticker/.cvsignore b/ticker/ticker/.cvsignore new file mode 100644 index 0000000..fecf58a --- /dev/null +++ b/ticker/ticker/.cvsignore @@ -0,0 +1 @@ +o-optimize diff --git a/ticker/ticker/Makefile b/ticker/ticker/Makefile new file mode 100644 index 0000000..5a92e90 --- /dev/null +++ b/ticker/ticker/Makefile @@ -0,0 +1,27 @@ +# +# $Id$ +# + +# +# RTEMS_MAKEFILE_PATH is typically set in an environment variable +# + +PGM=${ARCH}/ticker.exe + +# optional managers required +MANAGERS=all + +# C source names +CSRCS = init.c +COBJS = $(CSRCS:%.c=${ARCH}/%.o) + +include $(RTEMS_MAKEFILE_PATH)/Makefile.inc +include $(RTEMS_CUSTOM) +include $(PROJECT_ROOT)/make/leaf.cfg + +OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS) + +all: ${ARCH} $(PGM) + +$(PGM): $(OBJS) + $(make-exe) diff --git a/ticker/ticker/init.c b/ticker/ticker/init.c new file mode 100644 index 0000000..f3e8feb --- /dev/null +++ b/ticker/ticker/init.c @@ -0,0 +1,107 @@ +/* + * COPYRIGHT (c) 1989-2007. + * 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 <stdio.h> +#include <stdlib.h> + +#include <bsp.h> + +#include "../../testmacros.h" + +rtems_id Task_id[ 4 ]; /* array of task ids */ +rtems_name Task_name[ 4 ]; /* array of task names */ + +rtems_task Test_task( + rtems_task_argument unused +) +{ + rtems_id tid; + rtems_time_of_day time; + uint32_t task_index; + rtems_status_code status; + + status = rtems_task_ident( RTEMS_SELF, RTEMS_SEARCH_ALL_NODES, &tid ); + task_index = task_number( tid ); + for ( ; ; ) { + status = rtems_clock_get( RTEMS_CLOCK_GET_TOD, &time ); + if ( time.second >= 35 ) { + puts( "*** END OF CLOCK TICK TEST ***" ); + exit( 0 ); + } + put_name( Task_name[ task_index ], FALSE ); + print_time( " - rtems_clock_get - ", &time, "\n" ); + status = rtems_task_wake_after( task_index * 5 * get_ticks_per_second() ); + } +} + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_time_of_day time; + + puts( "\n\n*** CLOCK TICK TEST ***" ); + + time.year = 1988; + time.month = 12; + time.day = 31; + time.hour = 9; + time.minute = 0; + time.second = 0; + time.ticks = 0; + + status = rtems_clock_set( &time ); + + 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, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 1 ] + ); + status = rtems_task_create( + Task_name[ 2 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 2 ] + ); + status = rtems_task_create( + Task_name[ 3 ], 1, RTEMS_MINIMUM_STACK_SIZE * 2, RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ 3 ] + ); + + status = rtems_task_start( Task_id[ 1 ], Test_task, 1 ); + status = rtems_task_start( Task_id[ 2 ], Test_task, 2 ); + status = rtems_task_start( Task_id[ 3 ], Test_task, 3 ); + + status = rtems_task_delete( RTEMS_SELF ); +} + +/**************** START OF CONFIGURATION INFORMATION ****************/ + +#define CONFIGURE_INIT + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 4 + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE +#define CONFIGURE_INIT_TASK_STACK_SIZE (2 * RTEMS_MINIMUM_STACK_SIZE) + +#define CONFIGURE_EXTRA_TASK_STACKS (4 * RTEMS_MINIMUM_STACK_SIZE) + +#define CONFIGURE_MICROSECONDS_PER_TICK 1 + +#include <rtems/confdefs.h> + +/**************** END OF CONFIGURATION INFORMATION ****************/ + |