mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-21 22:44:02 +08:00
2008-01-07 Joel Sherrill <joel.sherrill@oarcorp.com>
* 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.
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
2008-01-07 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||
|
||||
* 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.
|
||||
|
||||
2007-12-21 Joel Sherrill <joel.sherrill@OARcorp.com>
|
||||
|
||||
* sp36/strict_order_mut.c: New file.
|
||||
|
||||
@@ -7,7 +7,7 @@ ACLOCAL_AMFLAGS = -I ../aclocal
|
||||
## spfatal is not included for now
|
||||
SUBDIRS = sp01 sp02 sp03 sp04 sp05 sp06 sp07 sp08 sp09 sp11 sp12 sp13 sp14 \
|
||||
sp15 sp16 sp17 sp19 sp20 sp21 sp22 sp23 sp24 sp25 sp26 sp27 sp28 sp29 \
|
||||
sp30 sp31 sp32 sp33 sp34 sp35 sp36 sp37 spsize
|
||||
sp30 sp31 sp32 sp33 sp34 sp35 sp37 sp38 sp39 spsize
|
||||
DIST_SUBDIRS = $(SUBDIRS) spfatal
|
||||
|
||||
include $(top_srcdir)/../automake/subdirs.am
|
||||
|
||||
@@ -62,6 +62,8 @@ sp34/Makefile
|
||||
sp35/Makefile
|
||||
sp36/Makefile
|
||||
sp37/Makefile
|
||||
sp38/Makefile
|
||||
sp39/Makefile
|
||||
spsize/Makefile
|
||||
spfatal/Makefile
|
||||
])
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
@@ -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
|
||||
@@ -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 );
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
*** TEST 38 ***
|
||||
rtems_signal_catch - handler installed
|
||||
Signal sent from ISR has been processed
|
||||
*** END OF TEST 38 ***
|
||||
@@ -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 <tmacros.h>
|
||||
|
||||
/* 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 <rtems/confdefs.h>
|
||||
|
||||
/* end of include file */
|
||||
@@ -0,0 +1,2 @@
|
||||
Makefile
|
||||
Makefile.in
|
||||
@@ -0,0 +1,27 @@
|
||||
##
|
||||
## $Id$
|
||||
##
|
||||
|
||||
MANAGERS = all
|
||||
|
||||
rtems_tests_PROGRAMS = sp39.exe
|
||||
sp39_exe_SOURCES = init.c system.h
|
||||
|
||||
dist_rtems_tests_DATA = sp39.scn
|
||||
|
||||
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
|
||||
include $(top_srcdir)/../automake/compile.am
|
||||
include $(top_srcdir)/../automake/leaf.am
|
||||
|
||||
sp39_exe_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
|
||||
|
||||
AM_CPPFLAGS += -I$(top_srcdir)/../support/include
|
||||
|
||||
LINK_OBJS = $(sp39_exe_OBJECTS) $(sp39_exe_LDADD)
|
||||
LINK_LIBS = $(sp39_exe_LDLIBS)
|
||||
|
||||
sp39.exe$(EXEEXT): $(sp39_exe_OBJECTS) $(sp39_exe_DEPENDENCIES)
|
||||
@rm -f sp39.exe$(EXEEXT)
|
||||
$(make-exe)
|
||||
|
||||
include $(top_srcdir)/../automake/local.am
|
||||
@@ -0,0 +1,161 @@
|
||||
/*
|
||||
* 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 case_hit;
|
||||
|
||||
rtems_id main_task;
|
||||
rtems_id other_task;
|
||||
|
||||
rtems_timer_service_routine test_event_from_isr(
|
||||
rtems_id timer,
|
||||
void *arg
|
||||
)
|
||||
{
|
||||
rtems_status_code status;
|
||||
|
||||
status = rtems_event_send( main_task, 0x01 );
|
||||
|
||||
if ( _Event_Sync_state == EVENT_SYNC_SATISFIED )
|
||||
case_hit = TRUE;
|
||||
}
|
||||
|
||||
rtems_timer_service_routine test_timeout_from_isr(
|
||||
rtems_id timer,
|
||||
void *arg
|
||||
)
|
||||
{
|
||||
if ( _Event_Sync_state != EVENT_SYNC_NOTHING_HAPPENED )
|
||||
return;
|
||||
|
||||
/*
|
||||
* The main task should have timed out and we are in the
|
||||
* event synchronization critical section with "timeout".
|
||||
*/
|
||||
|
||||
/*
|
||||
* This event send hits the critical section but sends to
|
||||
* another task so doesn't impact this critical section.
|
||||
*/
|
||||
rtems_event_send( other_task, 0x02 );
|
||||
|
||||
/*
|
||||
* This event send hits the main task but doesn't satisfy
|
||||
* it's blocking condition so it will still time out.
|
||||
*/
|
||||
rtems_event_send( main_task, 0x02 );
|
||||
|
||||
/*
|
||||
* This event send should cancel the main task's time out
|
||||
* and deliver the interrupt because both occurred simultaneously.
|
||||
*/
|
||||
rtems_event_send( main_task, 0x01 );
|
||||
|
||||
|
||||
case_hit = TRUE;
|
||||
}
|
||||
|
||||
rtems_task Init(
|
||||
rtems_task_argument argument
|
||||
)
|
||||
{
|
||||
rtems_status_code status;
|
||||
rtems_id timer;
|
||||
rtems_event_set out;
|
||||
int i;
|
||||
int max;
|
||||
int iterations = 0;
|
||||
|
||||
puts( "\n\n*** TEST 39 ***" );
|
||||
|
||||
main_task = rtems_task_self();
|
||||
|
||||
/*
|
||||
* Timer used in multiple ways
|
||||
*/
|
||||
status = rtems_timer_create( 1, &timer );
|
||||
directive_failed( status, "rtems_timer_create" );
|
||||
|
||||
status = rtems_task_create(
|
||||
0xa5a5a5a5,
|
||||
1,
|
||||
RTEMS_MINIMUM_STACK_SIZE,
|
||||
RTEMS_DEFAULT_MODES,
|
||||
RTEMS_DEFAULT_ATTRIBUTES,
|
||||
&other_task
|
||||
);
|
||||
directive_failed( status, "rtems_task_create" );
|
||||
|
||||
/*
|
||||
* Test Event send successful from ISR
|
||||
*/
|
||||
case_hit = FALSE;
|
||||
max = 1;
|
||||
|
||||
while (1) {
|
||||
if ( case_hit )
|
||||
break;
|
||||
status = rtems_timer_fire_after( timer, 1, test_event_from_isr, NULL );
|
||||
directive_failed( status, "timer_fire_after failed" );
|
||||
|
||||
for (i=0 ; i<max ; i++ )
|
||||
if ( _Event_Sync_state == EVENT_SYNC_SATISFIED )
|
||||
break;
|
||||
|
||||
status = rtems_event_receive( 0x01, RTEMS_DEFAULT_OPTIONS, 0, &out );
|
||||
directive_failed( status, "rtems_event_receive" );
|
||||
if ( case_hit == TRUE )
|
||||
break;
|
||||
max += 2;
|
||||
if ( ++iterations >= 0x10000 )
|
||||
break;
|
||||
}
|
||||
|
||||
printf(
|
||||
"Event sent from ISR hitting synchronization point has %soccurred\n",
|
||||
(( case_hit == TRUE ) ? "" : "NOT ")
|
||||
);
|
||||
|
||||
/*
|
||||
* Now try for a timeout case
|
||||
*/
|
||||
case_hit = FALSE;
|
||||
max = 1;
|
||||
|
||||
while (1) {
|
||||
status = rtems_timer_fire_after( timer, 1, test_timeout_from_isr, NULL );
|
||||
directive_failed( status, "timer_fire_after failed" );
|
||||
|
||||
|
||||
for (i=0 ; i<max ; i++ )
|
||||
if ( case_hit )
|
||||
break;
|
||||
|
||||
status = rtems_event_receive( 0x01, RTEMS_DEFAULT_OPTIONS, 1, &out );
|
||||
if ( status == RTEMS_SUCCESSFUL ) {
|
||||
break;
|
||||
}
|
||||
fatal_directive_status( status, RTEMS_TIMEOUT, "event_receive timeout" );
|
||||
max += 1;
|
||||
}
|
||||
|
||||
printf(
|
||||
"Event timeout hitting synchronization point has %soccurred\n",
|
||||
(( case_hit == TRUE ) ? "" : "NOT ")
|
||||
);
|
||||
|
||||
puts( "*** END OF TEST 39 ***" );
|
||||
rtems_test_exit( 0 );
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
|
||||
*** TEST 39 ***
|
||||
Event sent from ISR hitting synchronization point has occurred
|
||||
Event timeout hitting synchronization point has occurred
|
||||
*** END OF TEST 39 ***
|
||||
@@ -0,0 +1,38 @@
|
||||
/* 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 <tmacros.h>
|
||||
|
||||
/* 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_MICROSECONDS_PER_TICK 250
|
||||
|
||||
#define CONFIGURE_MAXIMUM_TASKS 2
|
||||
#define CONFIGURE_MAXIMUM_TIMERS 1
|
||||
|
||||
#include <rtems/confdefs.h>
|
||||
|
||||
/* end of include file */
|
||||
Reference in New Issue
Block a user