forked from Imagelibrary/rtems
2009-12-04 Sebastian Huber <Sebastian.Huber@embedded-brains.de>
* sp31/sp31.scn, sp31/task1.c, spintrcritical17/init.c: New test cases. Updated copyright notice.
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
2009-12-04 Sebastian Huber <Sebastian.Huber@embedded-brains.de>
|
||||
|
||||
* sp31/sp31.scn, sp31/task1.c, spintrcritical17/init.c: New test
|
||||
cases. Updated copyright notice.
|
||||
|
||||
2009-12-02 Ralf Corsépius <ralf.corsepius@rtems.org>
|
||||
|
||||
* sp25/task1.c: Use PRIuPTR for segment_sizes.
|
||||
|
||||
@@ -47,6 +47,16 @@ TA1 - rtems_timer_server_fire_when - timer 1 in 3 seconds
|
||||
TA1 - rtems_task_wake_after - 1 second
|
||||
TA1 - rtems_clock_get_tod - 09:00:11 12/31/1988
|
||||
TA1 - rtems_timer_cancel - timer 1
|
||||
TA1 - rtems_timer_server_fire_when - timer 1 in 3 seconds
|
||||
TA1 - rtems_timer_server_fire_when - timer 2 in 3 seconds
|
||||
TA1 - rtems_task_wake_after - 1 second
|
||||
TA1 - rtems_timer_server_fire_when - timer 2 in 3 seconds
|
||||
TA1 - rtems_timer_cancel - timer 1
|
||||
TA1 - rtems_timer_cancel - timer 2
|
||||
TA1 - rtems_timer_server_fire_when - timer 1 in 1 seconds
|
||||
TA1 - rtems_timer_server_fire_after - timer 2 in 1 tick
|
||||
TA1 - rtems_task_wake_after - 1 tick
|
||||
TA1 - rtems_timer_cancel - timer 1
|
||||
TA1 - rtems_task_wake_after - YIELD (only task at priority)
|
||||
TA1 - timer_deleting - timer 1
|
||||
*** END OF TEST 31 ***
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
* COPYRIGHT (c) 1989-2009.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
*
|
||||
* Copyright (c) 2009 embedded brains GmbH.
|
||||
*
|
||||
* 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.
|
||||
@@ -35,6 +37,14 @@ rtems_timer_service_routine Should_not_fire_TSR(
|
||||
TSR_fired = 1;
|
||||
}
|
||||
|
||||
rtems_timer_service_routine Do_nothing(
|
||||
rtems_id ignored_id,
|
||||
void *ignored_address
|
||||
)
|
||||
{
|
||||
/* Do nothing */
|
||||
}
|
||||
|
||||
static Watchdog_Interval schedule_time( void )
|
||||
{
|
||||
const Watchdog_Control *watchdog =
|
||||
@@ -271,6 +281,67 @@ rtems_task Task_1(
|
||||
status = rtems_timer_cancel( tmid );
|
||||
directive_failed( status, "rtems_timer_cancel" );
|
||||
|
||||
/* TOD timer insert with non empty TOD timer chain */
|
||||
|
||||
status = rtems_clock_get_tod( &time );
|
||||
directive_failed( status, "rtems_clock_get_tod" );
|
||||
|
||||
time.second += 3;
|
||||
|
||||
puts( "TA1 - rtems_timer_server_fire_when - timer 1 in 3 seconds" );
|
||||
status = rtems_timer_server_fire_when( tmid, &time, Do_nothing, NULL );
|
||||
directive_failed( status, "rtems_timer_server_fire_when" );
|
||||
|
||||
puts( "TA1 - rtems_timer_server_fire_when - timer 2 in 3 seconds" );
|
||||
status = rtems_timer_server_fire_when( tmid2, &time, Do_nothing, NULL );
|
||||
directive_failed( status, "rtems_timer_server_fire_when" );
|
||||
|
||||
puts( "TA1 - rtems_task_wake_after - 1 second" );
|
||||
status = rtems_task_wake_after( 1 * rtems_clock_get_ticks_per_second() );
|
||||
directive_failed( status, "rtems_task_wake_after" );
|
||||
|
||||
puts( "TA1 - rtems_timer_server_fire_when - timer 2 in 3 seconds" );
|
||||
status = rtems_timer_server_fire_when( tmid2, &time, Do_nothing, NULL );
|
||||
directive_failed( status, "rtems_timer_server_fire_when" );
|
||||
|
||||
puts( "TA1 - rtems_timer_cancel - timer 1" );
|
||||
status = rtems_timer_cancel( tmid );
|
||||
directive_failed( status, "rtems_timer_cancel" );
|
||||
|
||||
puts( "TA1 - rtems_timer_cancel - timer 2" );
|
||||
status = rtems_timer_cancel( tmid2 );
|
||||
directive_failed( status, "rtems_timer_cancel" );
|
||||
|
||||
/* TOD chain processing with time wrap */
|
||||
|
||||
time.second = 30;
|
||||
|
||||
status = rtems_clock_set( &time );
|
||||
directive_failed( status, "rtems_clock_set" );
|
||||
|
||||
time.second = 31;
|
||||
|
||||
puts( "TA1 - rtems_timer_server_fire_when - timer 1 in 1 seconds" );
|
||||
status = rtems_timer_server_fire_when( tmid, &time, Do_nothing, NULL );
|
||||
directive_failed( status, "rtems_timer_server_fire_when" );
|
||||
|
||||
time.second = 29;
|
||||
|
||||
status = rtems_clock_set( &time );
|
||||
directive_failed( status, "rtems_clock_set" );
|
||||
|
||||
puts( "TA1 - rtems_timer_server_fire_after - timer 2 in 1 tick" );
|
||||
status = rtems_timer_server_fire_after( tmid2, 1, Do_nothing, NULL );
|
||||
directive_failed( status, "rtems_timer_server_fire_after" );
|
||||
|
||||
puts( "TA1 - rtems_task_wake_after - 1 tick" );
|
||||
status = rtems_task_wake_after( 1 );
|
||||
directive_failed( status, "rtems_task_wake_after" );
|
||||
|
||||
puts( "TA1 - rtems_timer_cancel - timer 1" );
|
||||
status = rtems_timer_cancel( tmid );
|
||||
directive_failed( status, "rtems_timer_cancel" );
|
||||
|
||||
/* delete */
|
||||
puts( "TA1 - rtems_task_wake_after - YIELD (only task at priority)" );
|
||||
status = rtems_task_wake_after( RTEMS_YIELD_PROCESSOR );
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
/*
|
||||
* COPYRIGHT (c) 1989-2009.
|
||||
* On-Line Applications Research Corporation (OAR).
|
||||
* Copyright (c) 2009
|
||||
* embedded brains GmbH
|
||||
* Obere Lagerstr. 30
|
||||
* D-82178 Puchheim
|
||||
* Germany
|
||||
* <rtems@embedded-brains.de>
|
||||
*
|
||||
* The license and distribution terms for this file may be
|
||||
* found in the file LICENSE in this distribution or at
|
||||
@@ -12,33 +16,55 @@
|
||||
#include <tmacros.h>
|
||||
#include <intrcritical.h>
|
||||
|
||||
static rtems_id timer_0;
|
||||
static rtems_id timer_1;
|
||||
static rtems_id timer_2;
|
||||
#define TIMER_COUNT 4
|
||||
|
||||
volatile bool case_hit;
|
||||
#define TIMER_TRIGGER 0
|
||||
#define TIMER_RESET 1
|
||||
#define TIMER_NEVER_INTERVAL 2
|
||||
#define TIMER_NEVER_TOD 3
|
||||
|
||||
static rtems_id timer [TIMER_COUNT];
|
||||
|
||||
static rtems_time_of_day tod;
|
||||
|
||||
static volatile bool case_hit;
|
||||
|
||||
static void never_callback(rtems_id timer, void *arg)
|
||||
{
|
||||
rtems_test_assert(false);
|
||||
}
|
||||
|
||||
static void reset_callback(rtems_id timer, void *arg)
|
||||
static void reset_tod_timer(void)
|
||||
{
|
||||
rtems_status_code sc = RTEMS_SUCCESSFUL;
|
||||
|
||||
sc = rtems_timer_reset(timer_0);
|
||||
sc = rtems_timer_server_fire_when(
|
||||
timer [TIMER_NEVER_TOD],
|
||||
&tod,
|
||||
never_callback,
|
||||
NULL
|
||||
);
|
||||
directive_failed_with_level(sc, "rtems_timer_server_fire_after", -1);
|
||||
}
|
||||
|
||||
static void reset_callback(rtems_id timer_id, void *arg)
|
||||
{
|
||||
rtems_status_code sc = RTEMS_SUCCESSFUL;
|
||||
|
||||
sc = rtems_timer_reset(timer [TIMER_RESET]);
|
||||
directive_failed_with_level(sc, "rtems_timer_reset", -1);
|
||||
|
||||
sc = rtems_timer_reset(timer_1);
|
||||
sc = rtems_timer_reset(timer [TIMER_NEVER_INTERVAL]);
|
||||
directive_failed_with_level(sc, "rtems_timer_reset", -1);
|
||||
|
||||
reset_tod_timer();
|
||||
|
||||
if (!case_hit) {
|
||||
case_hit = _Timer_server->insert_chain != NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void trigger_callback(rtems_id timer, void *arg)
|
||||
static void trigger_callback(rtems_id timer_id, void *arg)
|
||||
{
|
||||
rtems_status_code sc = RTEMS_SUCCESSFUL;
|
||||
|
||||
@@ -52,33 +78,30 @@ static void trigger_callback(rtems_id timer, void *arg)
|
||||
rtems_test_exit(0);
|
||||
}
|
||||
|
||||
sc = rtems_timer_reset(timer_2);
|
||||
sc = rtems_timer_reset(timer [TIMER_TRIGGER]);
|
||||
directive_failed(sc, "rtems_timer_reset");
|
||||
}
|
||||
|
||||
rtems_task Init( rtems_task_argument ignored )
|
||||
{
|
||||
rtems_status_code sc = RTEMS_SUCCESSFUL;
|
||||
size_t i = 0;
|
||||
|
||||
puts("\n\n*** TEST INTERRUPT CRITICAL SECTION 17 ***");
|
||||
|
||||
sc = rtems_timer_create(
|
||||
rtems_build_name('T', 'I', 'M', '0'),
|
||||
&timer_0
|
||||
);
|
||||
directive_failed(sc, "rtems_timer_create");
|
||||
build_time(&tod, 4, 12, 2009, 9, 34, 11, 0);
|
||||
sc = rtems_clock_set(&tod);
|
||||
directive_failed(sc, "rtems_clock_set");
|
||||
|
||||
sc = rtems_timer_create(
|
||||
rtems_build_name('T', 'I', 'M', '1'),
|
||||
&timer_1
|
||||
);
|
||||
directive_failed(sc, "rtems_timer_create");
|
||||
++tod.year;
|
||||
|
||||
for (i = 0; i < TIMER_COUNT; ++i) {
|
||||
sc = rtems_timer_create(
|
||||
rtems_build_name('T', 'I', 'M', '2'),
|
||||
&timer_2
|
||||
rtems_build_name('T', 'I', 'M', '0' + i),
|
||||
&timer [i]
|
||||
);
|
||||
directive_failed(sc, "rtems_timer_create");
|
||||
}
|
||||
|
||||
sc = rtems_timer_initiate_server(
|
||||
RTEMS_MINIMUM_PRIORITY,
|
||||
@@ -88,15 +111,17 @@ rtems_task Init( rtems_task_argument ignored )
|
||||
directive_failed(sc, "rtems_timer_initiate_server");
|
||||
|
||||
sc = rtems_timer_server_fire_after(
|
||||
timer_0,
|
||||
timer [TIMER_NEVER_INTERVAL],
|
||||
2,
|
||||
never_callback,
|
||||
NULL
|
||||
);
|
||||
directive_failed(sc, "rtems_timer_server_fire_after");
|
||||
|
||||
reset_tod_timer();
|
||||
|
||||
sc = rtems_timer_fire_after(
|
||||
timer_1,
|
||||
timer [TIMER_RESET],
|
||||
1,
|
||||
reset_callback,
|
||||
NULL
|
||||
@@ -104,7 +129,7 @@ rtems_task Init( rtems_task_argument ignored )
|
||||
directive_failed(sc, "rtems_timer_fire_after");
|
||||
|
||||
sc = rtems_timer_server_fire_after(
|
||||
timer_2,
|
||||
timer [TIMER_TRIGGER],
|
||||
1,
|
||||
trigger_callback,
|
||||
NULL
|
||||
@@ -122,7 +147,7 @@ rtems_task Init( rtems_task_argument ignored )
|
||||
#define CONFIGURE_MICROSECONDS_PER_TICK 1000
|
||||
|
||||
#define CONFIGURE_MAXIMUM_TASKS 2
|
||||
#define CONFIGURE_MAXIMUM_TIMERS 3
|
||||
#define CONFIGURE_MAXIMUM_TIMERS 4
|
||||
|
||||
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
|
||||
|
||||
|
||||
Reference in New Issue
Block a user