From fa9889742a14b5095e03cb63a02b2caf12d11494 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 7 Jan 2008 15:07:47 +0000 Subject: 2008-01-07 Joel Sherrill * Makefile.am, configure.ac: Added sp38 and sp39. * sp38/.cvsignore, sp38/Makefile.am, sp38/init.c, sp38/sp38.scn, sp38/system.h, sp39/.cvsignore, sp39/Makefile.am, sp39/init.c, sp39/sp39.scn, sp39/system.h: New files. --- testsuites/sptests/sp38/.cvsignore | 2 + testsuites/sptests/sp38/Makefile.am | 27 +++++++++++ testsuites/sptests/sp38/init.c | 93 +++++++++++++++++++++++++++++++++++++ testsuites/sptests/sp38/sp38.scn | 4 ++ testsuites/sptests/sp38/system.h | 36 ++++++++++++++ 5 files changed, 162 insertions(+) create mode 100644 testsuites/sptests/sp38/.cvsignore create mode 100644 testsuites/sptests/sp38/Makefile.am create mode 100644 testsuites/sptests/sp38/init.c create mode 100644 testsuites/sptests/sp38/sp38.scn create mode 100644 testsuites/sptests/sp38/system.h (limited to 'testsuites/sptests/sp38') diff --git a/testsuites/sptests/sp38/.cvsignore b/testsuites/sptests/sp38/.cvsignore new file mode 100644 index 0000000000..282522db03 --- /dev/null +++ b/testsuites/sptests/sp38/.cvsignore @@ -0,0 +1,2 @@ +Makefile +Makefile.in diff --git a/testsuites/sptests/sp38/Makefile.am b/testsuites/sptests/sp38/Makefile.am new file mode 100644 index 0000000000..6cf4f24e27 --- /dev/null +++ b/testsuites/sptests/sp38/Makefile.am @@ -0,0 +1,27 @@ +## +## $Id$ +## + +MANAGERS = all + +rtems_tests_PROGRAMS = sp38.exe +sp38_exe_SOURCES = init.c system.h + +dist_rtems_tests_DATA = sp38.scn + +include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg +include $(top_srcdir)/../automake/compile.am +include $(top_srcdir)/../automake/leaf.am + +sp38_exe_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel) + +AM_CPPFLAGS += -I$(top_srcdir)/../support/include + +LINK_OBJS = $(sp38_exe_OBJECTS) $(sp38_exe_LDADD) +LINK_LIBS = $(sp38_exe_LDLIBS) + +sp38.exe$(EXEEXT): $(sp38_exe_OBJECTS) $(sp38_exe_DEPENDENCIES) + @rm -f sp38.exe$(EXEEXT) + $(make-exe) + +include $(top_srcdir)/../automake/local.am diff --git a/testsuites/sptests/sp38/init.c b/testsuites/sptests/sp38/init.c new file mode 100644 index 0000000000..2a5108b779 --- /dev/null +++ b/testsuites/sptests/sp38/init.c @@ -0,0 +1,93 @@ +/* + * Classic API Signal to Task from ISR + * + * 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$ + */ + +#define TEST_INIT +#include "system.h" + +volatile boolean signal_sent; +volatile boolean signal_processed; + +rtems_id main_task; + +void signal_handler( + rtems_signal_set signals +) +{ + signal_processed = TRUE; +} + +rtems_timer_service_routine test_signal_from_isr( + rtems_id timer, + void *arg +) +{ + rtems_status_code status; + + status = rtems_signal_send( main_task, 0x0a0b0c0d ); + directive_failed_with_level( status, "rtems_signal_send", 1 ); + + signal_sent = TRUE; +} + +rtems_task Init( + rtems_task_argument argument +) +{ + rtems_status_code status; + rtems_id timer; + rtems_interval start; + rtems_interval now; + + puts( "\n\n*** TEST 38 ***" ); + + main_task = rtems_task_self(); + + /* + * Timer used in multiple ways + */ + status = rtems_timer_create( 1, &timer ); + directive_failed( status, "rtems_timer_create" ); + + /* + * Get starting time + */ + status = rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &start ); + directive_failed( status, "rtems_clock_get start" ); + + status = rtems_signal_catch( signal_handler, RTEMS_DEFAULT_MODES ); + directive_failed( status, "rtems_signal_catch" ); + puts( "rtems_signal_catch - handler installed" ); + + /* + * Test Signal from ISR + */ + signal_sent = FALSE; + + status = rtems_timer_fire_after( timer, 10, test_signal_from_isr, NULL ); + directive_failed( status, "timer_fire_after failed" ); + + while (1) { + status = rtems_clock_get( RTEMS_CLOCK_GET_TICKS_SINCE_BOOT, &now ); + directive_failed( status, "rtems_clock_get now" ); + if ( (now-start) > 100 ) { + puts( "Signal from ISR did not get processed\n" ); + rtems_test_exit( 0 ); + } + if ( signal_processed ) + break; + } + + puts( "Signal sent from ISR has been processed" ); + puts( "*** END OF TEST 38 ***" ); + rtems_test_exit( 0 ); +} diff --git a/testsuites/sptests/sp38/sp38.scn b/testsuites/sptests/sp38/sp38.scn new file mode 100644 index 0000000000..fce980dedc --- /dev/null +++ b/testsuites/sptests/sp38/sp38.scn @@ -0,0 +1,4 @@ +*** TEST 38 *** +rtems_signal_catch - handler installed +Signal sent from ISR has been processed +*** END OF TEST 38 *** diff --git a/testsuites/sptests/sp38/system.h b/testsuites/sptests/sp38/system.h new file mode 100644 index 0000000000..84b7ab8614 --- /dev/null +++ b/testsuites/sptests/sp38/system.h @@ -0,0 +1,36 @@ +/* system.h + * + * This include file contains information that is included in every + * function in the test set. + * + * 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 + +/* functions */ + +rtems_task Init( + rtems_task_argument argument +); + +/* configuration information */ + +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_MAXIMUM_TASKS 1 +#define CONFIGURE_MAXIMUM_TIMERS 1 + +#include + +/* end of include file */ -- cgit v1.2.3