From 3083373e471be76b1624e0583c5a3f2f455d41c1 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Thu, 6 Aug 2009 20:25:58 +0000 Subject: Initial import of reorganized examples. --- ticker/Makefile | 10 ++++ ticker/low_ticker/.cvsignore | 1 + ticker/low_ticker/Makefile | 27 +++++++++++ ticker/low_ticker/init.c | 90 +++++++++++++++++++++++++++++++++++ ticker/low_ticker1/.cvsignore | 1 + ticker/low_ticker1/Makefile | 27 +++++++++++ ticker/low_ticker1/init.c | 87 ++++++++++++++++++++++++++++++++++ ticker/low_ticker2/.cvsignore | 1 + ticker/low_ticker2/Makefile | 27 +++++++++++ ticker/low_ticker2/init.c | 80 +++++++++++++++++++++++++++++++ ticker/ticker/.cvsignore | 1 + ticker/ticker/Makefile | 27 +++++++++++ ticker/ticker/init.c | 107 ++++++++++++++++++++++++++++++++++++++++++ 13 files changed, 486 insertions(+) create mode 100644 ticker/Makefile create mode 100644 ticker/low_ticker/.cvsignore create mode 100644 ticker/low_ticker/Makefile create mode 100644 ticker/low_ticker/init.c create mode 100644 ticker/low_ticker1/.cvsignore create mode 100644 ticker/low_ticker1/Makefile create mode 100644 ticker/low_ticker1/init.c create mode 100644 ticker/low_ticker2/.cvsignore create mode 100644 ticker/low_ticker2/Makefile create mode 100644 ticker/low_ticker2/init.c create mode 100644 ticker/ticker/.cvsignore create mode 100644 ticker/ticker/Makefile create mode 100644 ticker/ticker/init.c (limited to 'ticker') diff --git a/ticker/Makefile b/ticker/Makefile new file mode 100644 index 0000000..827a6cd --- /dev/null +++ b/ticker/Makefile @@ -0,0 +1,10 @@ +# +# $Id$ +# + +include $(RTEMS_MAKEFILE_PATH)/Makefile.inc +include $(RTEMS_CUSTOM) +include $(RTEMS_ROOT)/make/directory.cfg + +# Ticker Variations +SUBDIRS = ticker low_ticker low_ticker1 low_ticker2 diff --git a/ticker/low_ticker/.cvsignore b/ticker/low_ticker/.cvsignore new file mode 100644 index 0000000..fecf58a --- /dev/null +++ b/ticker/low_ticker/.cvsignore @@ -0,0 +1 @@ +o-optimize diff --git a/ticker/low_ticker/Makefile b/ticker/low_ticker/Makefile new file mode 100644 index 0000000..4201727 --- /dev/null +++ b/ticker/low_ticker/Makefile @@ -0,0 +1,27 @@ +# +# $Id$ +# + +# +# RTEMS_MAKEFILE_PATH is typically set in an environment variable +# + +PGM=${ARCH}/low_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/low_ticker/init.c b/ticker/low_ticker/init.c new file mode 100644 index 0000000..27e27b2 --- /dev/null +++ b/ticker/low_ticker/init.c @@ -0,0 +1,90 @@ +/* + * 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 + +#include + +rtems_task Test_task( + rtems_task_argument task_index +) +{ + rtems_time_of_day time; + rtems_status_code status; + + for ( ; ; ) { + status = rtems_clock_get_tod( &time ); + if ( time.second >= 35 ) { + printk( "*** END OF LOW MEMORY CLOCK TICK TEST ***\n" ); + rtems_shutdown_executive( 0 ); + } + printk( "TA%d %s%02d:%02d:%02d %02d/%02d/%04d\n", + task_index, " - rtems_clock_get - ", + (int) time.hour, (int) time.minute, (int) time.second, + (int) time.month, (int) time.day, (int) time.year ); + status = rtems_task_wake_after( + task_index * 5 * rtems_clock_get_ticks_per_second() ); + } +} + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_time_of_day time; + rtems_id id; + int i; + + printk( "\n\n*** LOW MEMORY CLOCK TICK TEST ***\n" ); + + 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 ); + + for (i=1 ; i<=3 ; i++ ) { + status = rtems_task_create( + rtems_build_name( 'T', 'A', 0x30+1, ' ' ), 1, 0, RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, &id + ); + status = rtems_task_start( id, Test_task, i ); + } + + while( 1 ) + ; +} + +/**************** START OF CONFIGURATION INFORMATION ****************/ + +#define CONFIGURE_INIT + +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER +#define CONFIGURE_APPLICATION_DISABLE_FILESYSTEM +#define CONFIGURE_DISABLE_NEWLIB_REENTRANCY +#define CONFIGURE_TERMIOS_DISABLED +#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 0 +#define CONFIGURE_MINIMUM_TASK_STACK_SIZE 512 +#define CONFIGURE_MAXIMUM_PRIORITY 15 +#define CONFIGURE_DISABLE_CLASSIC_API_NOTEPADS +#define CONFIGURE_IDLE_TASK_BODY Init +#define CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION + +#define CONFIGURE_MAXIMUM_TASKS 3 + +#include + +/**************** END OF CONFIGURATION INFORMATION ****************/ diff --git a/ticker/low_ticker1/.cvsignore b/ticker/low_ticker1/.cvsignore new file mode 100644 index 0000000..fecf58a --- /dev/null +++ b/ticker/low_ticker1/.cvsignore @@ -0,0 +1 @@ +o-optimize diff --git a/ticker/low_ticker1/Makefile b/ticker/low_ticker1/Makefile new file mode 100644 index 0000000..e9c88b9 --- /dev/null +++ b/ticker/low_ticker1/Makefile @@ -0,0 +1,27 @@ +# +# $Id$ +# + +# +# RTEMS_MAKEFILE_PATH is typically set in an environment variable +# + +PGM=${ARCH}/low_ticker1.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/low_ticker1/init.c b/ticker/low_ticker1/init.c new file mode 100644 index 0000000..ef46f41 --- /dev/null +++ b/ticker/low_ticker1/init.c @@ -0,0 +1,87 @@ +/* + * 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 + +#include + +rtems_task Test_task( + rtems_task_argument task_index +) +{ + rtems_status_code status; + rtems_id period_id; + rtems_interval ticks; + struct timespec uptime; + + status = rtems_rate_monotonic_create( + rtems_build_name( 'P', 'E', 'R', 0x30+task_index ), + &period_id + ); + + ticks = task_index * 5 * rtems_clock_get_ticks_per_second(); + for ( ; ; ) { + status = rtems_rate_monotonic_period( period_id, ticks ); + + status = rtems_clock_get_uptime( &uptime ); + if ( uptime.tv_sec >= 35 ) { + printk( "*** END OF LOW MEMORY CLOCK TICK TEST (PERIODs) ***\n" ); + rtems_shutdown_executive( 0 ); + } + printk( "TA%d - rtems_clock_uptime - %d:%d\n", + task_index, uptime.tv_sec, uptime.tv_nsec + ); + } +} + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_id id; + int i; + + printk( "\n\n*** LOW MEMORY CLOCK TICK TEST (PERIODs) ***\n" ); + + for (i=1 ; i<=3 ; i++ ) { + status = rtems_task_create( + rtems_build_name( 'T', 'A', 0x30+1, ' ' ), 1, 0, RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, &id + ); + status = rtems_task_start( id, Test_task, i ); + } + + while( 1 ) + ; +} + +/**************** START OF CONFIGURATION INFORMATION ****************/ + +#define CONFIGURE_INIT + +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER +#define CONFIGURE_APPLICATION_DISABLE_FILESYSTEM +#define CONFIGURE_DISABLE_NEWLIB_REENTRANCY +#define CONFIGURE_TERMIOS_DISABLED +#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 0 +#define CONFIGURE_MINIMUM_TASK_STACK_SIZE 512 +#define CONFIGURE_MAXIMUM_PRIORITY 15 +#define CONFIGURE_DISABLE_CLASSIC_API_NOTEPADS +#define CONFIGURE_IDLE_TASK_BODY Init +#define CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION + +#define CONFIGURE_MAXIMUM_TASKS 3 +#define CONFIGURE_MAXIMUM_PERIODS 3 + +#include + +/**************** END OF CONFIGURATION INFORMATION ****************/ diff --git a/ticker/low_ticker2/.cvsignore b/ticker/low_ticker2/.cvsignore new file mode 100644 index 0000000..fecf58a --- /dev/null +++ b/ticker/low_ticker2/.cvsignore @@ -0,0 +1 @@ +o-optimize diff --git a/ticker/low_ticker2/Makefile b/ticker/low_ticker2/Makefile new file mode 100644 index 0000000..123f1fd --- /dev/null +++ b/ticker/low_ticker2/Makefile @@ -0,0 +1,27 @@ +# +# $Id$ +# + +# +# RTEMS_MAKEFILE_PATH is typically set in an environment variable +# + +PGM=${ARCH}/low_ticker2.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/low_ticker2/init.c b/ticker/low_ticker2/init.c new file mode 100644 index 0000000..fca66ca --- /dev/null +++ b/ticker/low_ticker2/init.c @@ -0,0 +1,80 @@ +/* + * 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 + +#include + +rtems_task Test_task( + rtems_task_argument task_index +) +{ + rtems_status_code status; + rtems_interval ticks; + struct timespec uptime; + + ticks = task_index * 5 * rtems_clock_get_ticks_per_second(); + for ( ; ; ) { + status = rtems_task_wake_after( ticks ); + + status = rtems_clock_get_uptime( &uptime ); + if ( uptime.tv_sec >= 35 ) { + printk( "*** END OF LOW MEMORY CLOCK TICK TEST (delay) ***\n" ); + rtems_shutdown_executive( 0 ); + } + printk( "TA%d - rtems_clock_uptime - %d:%d\n", + task_index, uptime.tv_sec, uptime.tv_nsec + ); + } +} + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_id id; + int i; + + printk( "\n\n*** LOW MEMORY CLOCK TICK TEST (delay) ***\n" ); + + for (i=1 ; i<=3 ; i++ ) { + status = rtems_task_create( + rtems_build_name( 'T', 'A', 0x30+1, ' ' ), 1, 0, RTEMS_DEFAULT_MODES, + RTEMS_DEFAULT_ATTRIBUTES, &id + ); + status = rtems_task_start( id, Test_task, i ); + } + + while( 1 ) + ; +} + +/**************** START OF CONFIGURATION INFORMATION ****************/ + +#define CONFIGURE_INIT + +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER +#define CONFIGURE_APPLICATION_DISABLE_FILESYSTEM +#define CONFIGURE_DISABLE_NEWLIB_REENTRANCY +#define CONFIGURE_TERMIOS_DISABLED +#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 0 +#define CONFIGURE_MINIMUM_TASK_STACK_SIZE 512 +#define CONFIGURE_MAXIMUM_PRIORITY 15 +#define CONFIGURE_DISABLE_CLASSIC_API_NOTEPADS +#define CONFIGURE_IDLE_TASK_BODY Init +#define CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION + +#define CONFIGURE_MAXIMUM_TASKS 3 + +#include + +/**************** END OF CONFIGURATION INFORMATION ****************/ 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 +#include + +#include + +#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 + +/**************** END OF CONFIGURATION INFORMATION ****************/ + -- cgit v1.2.3