Added timer server control block

Removed _Timer_Server thread pointer
Added _Timer_server pointer to the default timer server control block
Rework of the timer server implementation.
This commit is contained in:
Thomas Doerfler
2009-11-30 09:08:35 +00:00
parent 6cc3dfb59b
commit 6e51c4c9f7
23 changed files with 2413 additions and 353 deletions

View File

@@ -1,3 +1,17 @@
2009-11-30 Sebastian Huber <sebastian.huber@embedded-brains.de>
* rtems/include/rtems/rtems/timer.h: Added timer server control block
Timer_server_Control. Removed _Timer_Server thread pointer. Added
_Timer_server pointer to the default timer server control block.
* rtems/src/rtemstimer.c, rtems/src/timerreset.c,
rtems/src/timerserverfireafter.c, rtems/src/timerserverfirewhen.c:
Update for changes above.
* rtems/src/timerserver.c: Rework of the timer server implementation.
It is now possible to insert timers without the help of the timer
server thread. This reduces the need for a thread dispatch. The
timer server can now block on any resource type. Timer callbacks can
even wait for time.
2009-11-23 Joel Sherrill <joel.sherrill@oarcorp.com>
* libmisc/shell/shell.c: Always duplicate the environment passed to us

View File

@@ -25,6 +25,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.
@@ -52,6 +54,7 @@ extern "C" {
#include <rtems/score/object.h>
#include <rtems/score/watchdog.h>
#include <rtems/score/thread.h>
#include <rtems/score/chain.h>
#include <rtems/rtems/clock.h>
#include <rtems/rtems/attr.h>
@@ -119,19 +122,6 @@ typedef rtems_timer_service_routine ( *rtems_timer_service_routine_entry )(
void *
);
/**
* The following defines the information control block used to manage
* this class of objects.
*/
RTEMS_TIMER_EXTERN Objects_Information _Timer_Information;
/**
* Pointer to TCB of the Timer Server. This is NULL before the
* server is executing and task-based timers are not allowed to be
* initiated until the server is started.
*/
RTEMS_TIMER_EXTERN Thread_Control *_Timer_Server;
/**
* The following records define the control block used to manage
* each timer.
@@ -145,6 +135,91 @@ typedef struct {
Timer_Classes the_class;
} Timer_Control;
typedef struct Timer_server_Control Timer_server_Control;
/**
* @brief Method used to schedule the insertion of task based timers.
*/
typedef void (*Timer_server_Schedule_operation)(
Timer_server_Control *timer_server,
Timer_Control *timer
);
typedef struct {
/**
* @brief This watchdog that will be registered in the system tick mechanic
* for timer server wake-up.
*/
Watchdog_Control System_watchdog;
/**
* @brief Chain for watchdogs which will be triggered by the timer server.
*/
Chain_Control Chain;
/**
* @brief Last known time snapshot of the timer server.
*
* The units may be ticks or seconds.
*/
Watchdog_Interval volatile last_snapshot;
} Timer_server_Watchdogs;
struct Timer_server_Control {
/**
* @brief Timer server thread.
*/
Thread_Control *thread;
/**
* @brief The schedule operation method of the timer server.
*/
Timer_server_Schedule_operation schedule_operation;
/**
* @brief Interval watchdogs triggered by the timer server.
*/
Timer_server_Watchdogs Interval_watchdogs;
/**
* @brief TOD watchdogs triggered by the timer server.
*/
Timer_server_Watchdogs TOD_watchdogs;
/**
* @brief Chain of timers scheduled for insert.
*
* This pointer is not @c NULL whenever the interval and TOD chains are
* processed. After the processing this list will be checked and if
* necessary the processing will be restarted. Processing of these chains
* can be only interrupted through interrupts.
*/
Chain_Control *volatile insert_chain;
/**
* @brief Indicates that the timer server is active or not.
*
* The server is active after the delay on a system watchdog. The activity
* period of the server ends when no more watchdogs managed by the server
* fire. The system watchdogs must not be manipulated when the server is
* active.
*/
bool volatile active;
};
/**
* @brief Pointer to default timer server control block.
*
* This value is @c NULL when the default timer server is not initialized.
*/
RTEMS_TIMER_EXTERN Timer_server_Control *volatile _Timer_server;
/**
* The following defines the information control block used to manage
* this class of objects.
*/
RTEMS_TIMER_EXTERN Objects_Information _Timer_Information;
/**
* @brief _Timer_Manager_initialization
*
@@ -319,21 +394,6 @@ rtems_status_code rtems_timer_get_information(
rtems_timer_information *the_info
);
/**
* This type defines the method used to schedule the insertion of task
* based timers.
*/
typedef void (*Timer_Server_schedule_operation_t)(
Timer_Control *the_timer
);
/**
* This variable will point to the schedule operation method once the
* timer server is initialized.
*/
RTEMS_TIMER_EXTERN Timer_Server_schedule_operation_t
_Timer_Server_schedule_operation;
#ifndef __RTEMS_APPLICATION__
#include <rtems/rtems/timer.inl>
#endif

View File

@@ -56,10 +56,9 @@ void _Timer_Manager_initialization(void)
);
/*
* Initialize the pointer to the Timer Server TCB to NULL indicating
* that task-based timer support is not initialized.
* Initialize the pointer to the default timer server control block to NULL
* indicating that task-based timer support is not initialized.
*/
_Timer_Server = NULL;
_Timer_Server_schedule_operation = NULL;
_Timer_server = NULL;
}

View File

@@ -55,6 +55,8 @@ rtems_status_code rtems_timer_reset(
_Watchdog_Remove( &the_timer->Ticker );
_Watchdog_Insert( &_Watchdog_Ticks_chain, &the_timer->Ticker );
} else if ( the_timer->the_class == TIMER_INTERVAL_ON_TASK ) {
Timer_server_Control *timer_server = _Timer_server;
/*
* There is no way for a timer to have this class unless
* it was scheduled as a server fire. That requires that
@@ -62,13 +64,13 @@ rtems_status_code rtems_timer_reset(
* occur unless something is internally wrong.
*/
#if defined(RTEMS_DEBUG)
if ( !_Timer_Server_schedule_operation ) {
if ( !timer_server ) {
_Thread_Enable_dispatch();
return RTEMS_INCORRECT_STATE;
}
#endif
_Watchdog_Remove( &the_timer->Ticker );
(*_Timer_Server_schedule_operation)( the_timer );
(*timer_server->schedule_operation)( timer_server, the_timer );
} else {
/*
* Must be dormant or time of day timer (e.g. TIMER_DORMANT,

View File

@@ -15,6 +15,8 @@
/* COPYRIGHT (c) 1989-2008.
* 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.
@@ -39,308 +41,388 @@
#include <rtems/rtems/support.h>
#include <rtems/score/thread.h>
/**
* This chain contains the list of interval timers that are
* executed in the context of the Timer Server.
*/
Chain_Control _Timer_Ticks_chain;
static Timer_server_Control _Timer_server_Default;
/**
* This chain contains the list of time of day timers that are
* executed in the context of the Timer Server.
*/
Chain_Control _Timer_Seconds_chain;
/**
* This chain holds the set of timers to be inserted when the
* server runs again.
*/
Chain_Control _Timer_To_be_inserted;
/**
* This variables keeps track of the last time the Timer Server actually
* processed the ticks chain.
*/
Watchdog_Interval _Timer_Server_ticks_last_time;
/**
* This variable keeps track of the last time the Timer Server actually
* processed the seconds chain.
*/
Watchdog_Interval _Timer_Server_seconds_last_time;
/**
* This is the timer used to control when the Timer Server wakes up to
* service "when" timers.
*
* @note The timer in the Timer Server TCB is used for ticks timer.
*/
Watchdog_Control _Timer_Seconds_timer;
/**
* This method is used to temporarily disable updates to the
* Ticks Timer Chain managed by the Timer Server.
*/
#define _Timer_Server_stop_ticks_timer() \
_Watchdog_Remove( &_Timer_Server->Timer )
/**
* This method is used to temporarily disable updates to the
* Seconds Timer Chain managed by the Timer Server.
*/
#define _Timer_Server_stop_seconds_timer() \
_Watchdog_Remove( &_Timer_Seconds_timer );
/**
* This method resets a timer and places it on the Ticks chain. It
* is assumed that the timer has already been canceled.
*/
#define _Timer_Server_reset_ticks_timer() \
do { \
if ( !_Chain_Is_empty( &_Timer_Ticks_chain ) ) { \
_Watchdog_Insert_ticks( &_Timer_Server->Timer, \
((Watchdog_Control *)_Timer_Ticks_chain.first)->delta_interval ); \
} \
} while (0)
/**
* This method resets a timer and places it on the Seconds chain. It
* is assumed that the timer has already been canceled.
*/
#define _Timer_Server_reset_seconds_timer() \
do { \
if ( !_Chain_Is_empty( &_Timer_Seconds_chain ) ) { \
_Watchdog_Insert_seconds( &_Timer_Seconds_timer, \
((Watchdog_Control *)_Timer_Seconds_chain.first)->delta_interval ); \
} \
} while (0)
/**
* @brief _Timer_Server_process_insertions
*
* This method processes the set of timers scheduled for insertion
* onto one of the Timer Server chains.
*
* @note It is only to be called from the Timer Server task.
*/
static void _Timer_Server_process_insertions(void)
static void _Timer_server_Stop_interval_system_watchdog(
Timer_server_Control *ts
)
{
Timer_Control *the_timer;
_Watchdog_Remove( &ts->Interval_watchdogs.System_watchdog );
}
while ( 1 ) {
the_timer = (Timer_Control *) _Chain_Get( &_Timer_To_be_inserted );
if ( the_timer == NULL )
break;
static void _Timer_server_Reset_interval_system_watchdog(
Timer_server_Control *ts
)
{
ISR_Level level;
if ( the_timer->the_class == TIMER_INTERVAL_ON_TASK ) {
_Watchdog_Insert( &_Timer_Ticks_chain, &the_timer->Ticker );
} else if ( the_timer->the_class == TIMER_TIME_OF_DAY_ON_TASK ) {
_Watchdog_Insert( &_Timer_Seconds_chain, &the_timer->Ticker );
}
_Timer_server_Stop_interval_system_watchdog( ts );
_ISR_Disable( level );
if ( !_Chain_Is_empty( &ts->Interval_watchdogs.Chain ) ) {
Watchdog_Interval delta_interval =
_Watchdog_First( &ts->Interval_watchdogs.Chain )->delta_interval;
_ISR_Enable( level );
/*
* The unit is TICKS here.
*/
_Watchdog_Insert_ticks(
&ts->Interval_watchdogs.System_watchdog,
delta_interval
);
} else {
_ISR_Enable( level );
}
}
/**
* @brief _Timer_Server_process_ticks_chain
*
* This routine is responsible for adjusting the list of task-based
* interval timers to reflect the passage of time.
*
* @param[in] to_fire will contain the set of timers that are to be fired.
*
* @note It is only to be called from the Timer Server task.
*/
static void _Timer_Server_process_ticks_chain(
Chain_Control *to_fire
static void _Timer_server_Stop_tod_system_watchdog(
Timer_server_Control *ts
)
{
Watchdog_Interval snapshot;
Watchdog_Interval ticks;
snapshot = _Watchdog_Ticks_since_boot;
if ( snapshot >= _Timer_Server_ticks_last_time )
ticks = snapshot - _Timer_Server_ticks_last_time;
else
ticks = (0xFFFFFFFF - _Timer_Server_ticks_last_time) + snapshot;
_Timer_Server_ticks_last_time = snapshot;
_Watchdog_Adjust_to_chain( &_Timer_Ticks_chain, ticks, to_fire );
_Watchdog_Remove( &ts->TOD_watchdogs.System_watchdog );
}
/**
* @brief _Timer_Server_process_seconds_chain
*
* This routine is responsible for adjusting the list of task-based
* time of day timers to reflect the passage of time.
*
* @param[in] to_fire will contain the set of timers that are to be fired.
*
* @note It is only to be called from the Timer Server task.
*/
static void _Timer_Server_process_seconds_chain(
Chain_Control *to_fire
static void _Timer_server_Reset_tod_system_watchdog(
Timer_server_Control *ts
)
{
ISR_Level level;
_Timer_server_Stop_tod_system_watchdog( ts );
_ISR_Disable( level );
if ( !_Chain_Is_empty( &ts->TOD_watchdogs.Chain ) ) {
Watchdog_Interval delta_interval =
_Watchdog_First( &ts->TOD_watchdogs.Chain )->delta_interval;
_ISR_Enable( level );
/*
* The unit is SECONDS here.
*/
_Watchdog_Insert_seconds(
&ts->TOD_watchdogs.System_watchdog,
delta_interval
);
} else {
_ISR_Enable( level );
}
}
static void _Timer_server_Insert_timer(
Timer_server_Control *ts,
Timer_Control *timer
)
{
if ( timer->the_class == TIMER_INTERVAL_ON_TASK ) {
_Watchdog_Insert( &ts->Interval_watchdogs.Chain, &timer->Ticker );
} else if ( timer->the_class == TIMER_TIME_OF_DAY_ON_TASK ) {
_Watchdog_Insert( &ts->TOD_watchdogs.Chain, &timer->Ticker );
}
}
static void _Timer_server_Insert_timer_and_make_snapshot(
Timer_server_Control *ts,
Timer_Control *timer
)
{
Watchdog_Control *first_watchdog;
Watchdog_Interval delta_interval;
Watchdog_Interval last_snapshot;
Watchdog_Interval snapshot;
Watchdog_Interval ticks;
Watchdog_Interval delta;
ISR_Level level;
/*
* We have to update the time snapshots here, because otherwise we may have
* problems with the integer range of the delta values. The time delta DT
* from the last snapshot to now may be arbitrarily long. The last snapshot
* is the reference point for the delta chain. Thus if we do not update the
* reference point we have to add DT to the initial delta of the watchdog
* being inserted. This could result in an integer overflow.
*/
_Thread_Disable_dispatch();
if ( timer->the_class == TIMER_INTERVAL_ON_TASK ) {
/*
* We have to advance the last known ticks value of the server and update
* the watchdog chain accordingly.
*/
_ISR_Disable( level );
snapshot = _Watchdog_Ticks_since_boot;
last_snapshot = ts->Interval_watchdogs.last_snapshot;
if ( !_Chain_Is_empty( &ts->Interval_watchdogs.Chain ) ) {
first_watchdog = _Watchdog_First( &ts->Interval_watchdogs.Chain );
/*
* We assume adequate unsigned arithmetic here.
*/
delta = snapshot - last_snapshot;
delta_interval = first_watchdog->delta_interval;
if (delta_interval > delta) {
delta_interval -= delta;
} else {
delta_interval = 0;
}
first_watchdog->delta_interval = delta_interval;
}
ts->Interval_watchdogs.last_snapshot = snapshot;
_ISR_Enable( level );
_Watchdog_Insert( &ts->Interval_watchdogs.Chain, &timer->Ticker );
if ( !ts->active ) {
_Timer_server_Reset_interval_system_watchdog( ts );
}
} else if ( timer->the_class == TIMER_TIME_OF_DAY_ON_TASK ) {
/*
* We have to advance the last known seconds value of the server and update
* the watchdog chain accordingly.
*/
_ISR_Disable( level );
snapshot = (Watchdog_Interval) _TOD_Seconds_since_epoch();
last_snapshot = ts->TOD_watchdogs.last_snapshot;
if ( !_Chain_Is_empty( &ts->TOD_watchdogs.Chain ) ) {
first_watchdog = _Watchdog_First( &ts->TOD_watchdogs.Chain );
delta_interval = first_watchdog->delta_interval;
if ( snapshot > last_snapshot ) {
/*
* We advanced in time.
*/
delta = snapshot - last_snapshot;
if (delta_interval > delta) {
delta_interval -= delta;
} else {
delta_interval = 0;
}
} else {
/*
* Someone put us in the past.
*/
delta = last_snapshot - snapshot;
delta_interval += delta;
}
first_watchdog->delta_interval = delta_interval;
}
ts->TOD_watchdogs.last_snapshot = snapshot;
_ISR_Enable( level );
_Watchdog_Insert( &ts->TOD_watchdogs.Chain, &timer->Ticker );
if ( !ts->active ) {
_Timer_server_Reset_tod_system_watchdog( ts );
}
}
_Thread_Enable_dispatch();
}
static void _Timer_server_Schedule_operation_method(
Timer_server_Control *ts,
Timer_Control *timer
)
{
if ( ts->insert_chain == NULL ) {
_Timer_server_Insert_timer_and_make_snapshot( ts, timer );
} else {
/*
* We interrupted a critical section of the timer server. The timer
* server is not preemptible, so we must be in interrupt context here. No
* thread dispatch will happen until the timer server finishes its
* critical section. We have to use the protected chain methods because
* we may be interrupted by a higher priority interrupt.
*/
_Chain_Append( ts->insert_chain, &timer->Object.Node );
}
}
static void _Timer_server_Process_interval_watchdogs(
Timer_server_Watchdogs *watchdogs,
Chain_Control *fire_chain
)
{
Watchdog_Interval snapshot = _Watchdog_Ticks_since_boot;
/*
* We assume adequate unsigned arithmetic here.
*/
Watchdog_Interval delta = snapshot - watchdogs->last_snapshot;
watchdogs->last_snapshot = snapshot;
_Watchdog_Adjust_to_chain( &watchdogs->Chain, delta, fire_chain );
}
static void _Timer_server_Process_tod_watchdogs(
Timer_server_Watchdogs *watchdogs,
Chain_Control *fire_chain
)
{
Watchdog_Interval snapshot = (Watchdog_Interval) _TOD_Seconds_since_epoch();
Watchdog_Interval last_snapshot = watchdogs->last_snapshot;
Watchdog_Interval delta;
/*
* Process the seconds chain. Start by checking that the Time
* of Day (TOD) has not been set backwards. If it has then
* we want to adjust the _Timer_Seconds_chain to indicate this.
* we want to adjust the watchdogs->Chain to indicate this.
*/
snapshot = _TOD_Seconds_since_epoch();
if ( snapshot > _Timer_Server_seconds_last_time ) {
if ( snapshot > last_snapshot ) {
/*
* This path is for normal forward movement and cases where the
* TOD has been set forward.
*/
ticks = snapshot - _Timer_Server_seconds_last_time;
_Watchdog_Adjust_to_chain( &_Timer_Seconds_chain, ticks, to_fire );
delta = snapshot - last_snapshot;
_Watchdog_Adjust_to_chain( &watchdogs->Chain, delta, fire_chain );
} else if ( snapshot < _Timer_Server_seconds_last_time ) {
} else if ( snapshot < last_snapshot ) {
/*
* The current TOD is before the last TOD which indicates that
* TOD has been set backwards.
*/
ticks = _Timer_Server_seconds_last_time - snapshot;
_Watchdog_Adjust( &_Timer_Seconds_chain, WATCHDOG_BACKWARD, ticks );
delta = last_snapshot - snapshot;
_Watchdog_Adjust( &watchdogs->Chain, WATCHDOG_BACKWARD, delta );
}
_Timer_Server_seconds_last_time = snapshot;
watchdogs->last_snapshot = snapshot;
}
/**
* @brief _Timer_Server_body
*
* This is the server for task based timers. This task executes whenever
* a task-based timer should fire. It services both "after" and "when"
* timers. It is not created automatically but must be created explicitly
* by the application before task-based timers may be initiated.
*
* @param[in] ignored is the the task argument that is ignored
*/
rtems_task _Timer_Server_body(
rtems_task_argument argument __attribute__((unused))
)
static void _Timer_server_Process_insertions( Timer_server_Control *ts )
{
Chain_Control to_fire;
while ( true ) {
Timer_Control *timer = (Timer_Control *) _Chain_Get( ts->insert_chain );
_Chain_Initialize_empty( &to_fire );
/*
* Initialize the "last time" markers to indicate the timer that
* the server was initiated.
*/
_Timer_Server_ticks_last_time = _Watchdog_Ticks_since_boot;
_Timer_Server_seconds_last_time = _TOD_Seconds_since_epoch();
/*
* Insert the timers that were inserted before we got to run.
* This should be done with dispatching disabled.
*/
_Thread_Disable_dispatch();
_Timer_Server_process_insertions();
_Thread_Enable_dispatch();
while(1) {
/*
* Block until there is something to do.
*/
_Thread_Disable_dispatch();
_Thread_Set_state( _Timer_Server, STATES_DELAYING );
_Timer_Server_reset_ticks_timer();
_Timer_Server_reset_seconds_timer();
_Thread_Enable_dispatch();
/********************************************************************
********************************************************************
**** TIMER SERVER BLOCKS HERE ****
********************************************************************
********************************************************************/
/*
* Disable dispatching while processing the timers since we want
* the removal of the timers from the chain to be atomic.
*
* NOTE: Dispatching is disabled for interrupt based TSRs.
* Dispatching is enabled for task based TSRs so they
* can temporarily malloc memory or block.
* _ISR_Nest_level is 0 for task-based TSRs and non-zero
* for the others.
*/
_Thread_Disable_dispatch();
/*
* At this point, at least one of the timers this task relies
* upon has fired. Stop them both while we process any outstanding
* timers. Before we block, we will restart them.
*/
_Timer_Server_stop_ticks_timer();
_Timer_Server_stop_seconds_timer();
/*
* Remove all the timers that need to fire so we can invoke them
* outside the critical section.
*/
_Timer_Server_process_ticks_chain( &to_fire );
_Timer_Server_process_seconds_chain( &to_fire );
/*
* Insert the timers that have been requested to be inserted.
*/
_Timer_Server_process_insertions();
/*
* Enable dispatching to process the set that are ready "to fire."
*/
_Thread_Enable_dispatch();
/*
* Now we actually invoke the TSR for all the timers that fired.
* This is done with dispatching
*/
while (1) {
Watchdog_Control *watch;
ISR_Level level;
_ISR_Disable( level );
watch = (Watchdog_Control *) _Chain_Get_unprotected( &to_fire );
if ( watch == NULL ) {
_ISR_Enable( level );
break;
}
watch->state = WATCHDOG_INACTIVE;
_ISR_Enable( level );
(*watch->routine)( watch->id, watch->user_data );
if ( timer == NULL ) {
break;
}
/*
* Insert the timers that have been requested to be inserted.
*/
_Timer_Server_process_insertions();
_Timer_server_Insert_timer( ts, timer );
}
}
static void _Timer_server_Get_watchdogs_that_fire_now(
Timer_server_Control *ts,
Chain_Control *insert_chain,
Chain_Control *fire_chain
)
{
/*
* Afterwards all timer inserts are directed to this chain and the interval
* and TOD chains will be no more modified by other parties.
*/
ts->insert_chain = insert_chain;
while ( true ) {
ISR_Level level;
/*
* Remove all the watchdogs that need to fire so we can invoke them.
*/
_Timer_server_Process_interval_watchdogs(
&ts->Interval_watchdogs,
fire_chain
);
_Timer_server_Process_tod_watchdogs( &ts->TOD_watchdogs, fire_chain );
/*
* The insertions have to take place here, because they reference the
* current time. The previous process methods take a snapshot of the
* current time. In case someone inserts a watchdog with an initial value
* of zero it will be processed in the next iteration of the timer server
* body loop.
*/
_Timer_server_Process_insertions( ts );
_ISR_Disable( level );
if ( _Chain_Is_empty( insert_chain ) ) {
ts->insert_chain = NULL;
_ISR_Enable( level );
break;
} else {
_ISR_Enable( level );
}
}
}
/**
* This method schedules the insertion of timers on the proper list. It
* wakes up the Timer Server task to process the insertion.
* @brief Timer server body.
*
* @param[in] the_timer is the timer to insert
*
* @note It is highly likely the executing task will be preempted after
* the directive invoking this is executed.
* This is the server for task based timers. This task executes whenever a
* task-based timer should fire. It services both "after" and "when" timers.
* It is not created automatically but must be created explicitly by the
* application before task-based timers may be initiated. The parameter
* @a arg points to the corresponding timer server control block.
*/
static void _Timer_Server_schedule_operation_method(
Timer_Control *the_timer
static rtems_task _Timer_server_Body(
rtems_task_argument arg
)
{
_Chain_Append( &_Timer_To_be_inserted, &the_timer->Object.Node );
_Watchdog_Remove( &_Timer_Server->Timer );
_Thread_Delay_ended( _Timer_Server->Object.id, NULL );
Timer_server_Control *ts = (Timer_server_Control *) arg;
Chain_Control insert_chain;
Chain_Control fire_chain;
_Chain_Initialize_empty( &insert_chain );
_Chain_Initialize_empty( &fire_chain );
while ( true ) {
_Timer_server_Get_watchdogs_that_fire_now( ts, &insert_chain, &fire_chain );
if ( !_Chain_Is_empty( &fire_chain ) ) {
/*
* Fire the watchdogs.
*/
while ( true ) {
Watchdog_Control *watchdog;
ISR_Level level;
/*
* It is essential that interrupts are disable here since an interrupt
* service routine may remove a watchdog from the chain.
*/
_ISR_Disable( level );
watchdog = (Watchdog_Control *) _Chain_Get_unprotected( &fire_chain );
if ( watchdog != NULL ) {
watchdog->state = WATCHDOG_INACTIVE;
_ISR_Enable( level );
} else {
_ISR_Enable( level );
break;
}
/*
* The timer server may block here and wait for resources or time.
* The system watchdogs are inactive and will remain inactive since
* the active flag of the timer server is true.
*/
(*watchdog->routine)( watchdog->id, watchdog->user_data );
}
} else {
ts->active = false;
/*
* Block until there is something to do.
*/
_Thread_Disable_dispatch();
_Thread_Set_state( ts->thread, STATES_DELAYING );
_Timer_server_Reset_interval_system_watchdog( ts );
_Timer_server_Reset_tod_system_watchdog( ts );
_Thread_Enable_dispatch();
ts->active = true;
/*
* Maybe an interrupt did reset the system timers, so we have to stop
* them here. Since we are active now, there will be no more resets
* until we are inactive again.
*/
_Timer_server_Stop_interval_system_watchdog( ts );
_Timer_server_Stop_tod_system_watchdog( ts );
}
}
}
/**
@@ -353,7 +435,7 @@ static void _Timer_Server_schedule_operation_method(
* @param[in] stack_size is the stack size in bytes
* @param[in] attribute_set is the timer server attributes
*
* @return This method returns RTEMS_SUCCESSFUL if successful and an
* @return This method returns RTEMS_SUCCESSFUL if successful and an
* error code otherwise.
*/
rtems_status_code rtems_timer_initiate_server(
@@ -362,11 +444,12 @@ rtems_status_code rtems_timer_initiate_server(
rtems_attribute attribute_set
)
{
rtems_id id;
rtems_status_code status;
rtems_task_priority _priority;
static bool initialized = false;
bool tmpInitialized;
rtems_id id;
rtems_status_code status;
rtems_task_priority _priority;
static bool initialized = false;
bool tmpInitialized;
Timer_server_Control *ts = &_Timer_server_Default;
/*
* Make sure the requested priority is valid. The if is
@@ -391,11 +474,6 @@ rtems_status_code rtems_timer_initiate_server(
if ( tmpInitialized )
return RTEMS_INCORRECT_STATE;
/*
* Initialize the set of timers to be inserted by the server.
*/
_Chain_Initialize_empty( &_Timer_To_be_inserted );
/*
* Create the Timer Server with the name the name of "TIME". The attribute
* RTEMS_SYSTEM_TASK allows us to set a priority to 0 which will makes it
@@ -433,11 +511,8 @@ rtems_status_code rtems_timer_initiate_server(
/*
* We work with the TCB pointer, not the ID, so we need to convert
* to a TCB pointer from here out.
*
* NOTE: Setting the pointer to the Timer Server TCB to a value other than
* NULL indicates that task-based timer support is initialized.
*/
_Timer_Server = (Thread_Control *)_Objects_Get_local_object(
ts->thread = (Thread_Control *)_Objects_Get_local_object(
&_RTEMS_tasks_Information,
_Objects_Get_index(id)
);
@@ -445,31 +520,52 @@ rtems_status_code rtems_timer_initiate_server(
/*
* Initialize the timer lists that the server will manage.
*/
_Chain_Initialize_empty( &_Timer_Ticks_chain );
_Chain_Initialize_empty( &_Timer_Seconds_chain );
_Chain_Initialize_empty( &ts->Interval_watchdogs.Chain );
_Chain_Initialize_empty( &ts->TOD_watchdogs.Chain );
/*
* Initialize the timers that will be used to control when the
* Timer Server wakes up and services the task-based timers.
*/
_Watchdog_Initialize( &_Timer_Server->Timer, _Thread_Delay_ended, id, NULL );
_Watchdog_Initialize( &_Timer_Seconds_timer, _Thread_Delay_ended, id, NULL );
_Watchdog_Initialize(
&ts->Interval_watchdogs.System_watchdog,
_Thread_Delay_ended,
id,
NULL
);
_Watchdog_Initialize(
&ts->TOD_watchdogs.System_watchdog,
_Thread_Delay_ended,
id,
NULL
);
/*
* Initialize the pointer to the timer reset method so applications
* that do not use the Timer Server do not have to pull it in.
* Initialize the pointer to the timer schedule method so applications that
* do not use the Timer Server do not have to pull it in.
*/
_Timer_Server_schedule_operation = _Timer_Server_schedule_operation_method;
ts->schedule_operation = _Timer_server_Schedule_operation_method;
ts->Interval_watchdogs.last_snapshot = _Watchdog_Ticks_since_boot;
ts->TOD_watchdogs.last_snapshot = (Watchdog_Interval) _TOD_Seconds_since_epoch();
ts->insert_chain = NULL;
ts->active = false;
/*
* The default timer server is now available.
*/
_Timer_server = ts;
/*
* Start the timer server
*/
status = rtems_task_start(
id, /* the id from create */
_Timer_Server_body, /* the timer server entry point */
0 /* there is no argument */
id,
_Timer_server_Body,
(rtems_task_argument) ts
);
#if defined(RTEMS_DEBUG)
/*
* One would expect a call to rtems_task_delete() here to clean up

View File

@@ -53,8 +53,9 @@ rtems_status_code rtems_timer_server_fire_after(
Timer_Control *the_timer;
Objects_Locations location;
ISR_Level level;
Timer_server_Control *timer_server = _Timer_server;
if ( !_Timer_Server )
if ( !timer_server )
return RTEMS_INCORRECT_STATE;
if ( !routine )
@@ -92,12 +93,7 @@ rtems_status_code rtems_timer_server_fire_after(
the_timer->Ticker.initial = ticks;
_ISR_Enable( level );
/*
* _Timer_Server_schedule_operation != NULL because we checked that
* _Timer_Server was != NULL above. Both are set at the same time.
*/
(*_Timer_Server_schedule_operation)( the_timer );
(*timer_server->schedule_operation)( timer_server, the_timer );
_Thread_Enable_dispatch();
return RTEMS_SUCCESSFUL;

View File

@@ -53,8 +53,9 @@ rtems_status_code rtems_timer_server_fire_when(
Timer_Control *the_timer;
Objects_Locations location;
rtems_interval seconds;
Timer_server_Control *timer_server = _Timer_server;
if ( !_Timer_Server )
if ( !timer_server )
return RTEMS_INCORRECT_STATE;
if ( !_TOD_Is_set )
@@ -79,12 +80,7 @@ rtems_status_code rtems_timer_server_fire_when(
_Watchdog_Initialize( &the_timer->Ticker, routine, id, user_data );
the_timer->Ticker.initial = seconds - _TOD_Seconds_since_epoch();
/*
* _Timer_Server_schedule_operation != NULL because we checked that
* _Timer_Server was != NULL above. Both are set at the same time.
*/
(*_Timer_Server_schedule_operation)( the_timer );
(*timer_server->schedule_operation)( timer_server, the_timer );
_Thread_Enable_dispatch();
return RTEMS_SUCCESSFUL;

View File

@@ -1,3 +1,15 @@
2009-11-30 Sebastian Huber <Sebastian.Huber@embedded-brains.de>
* sp68/init.c, sp68/Makefile.am, sp68/sp68.doc, sp68/sp68.scn,
spintrcritical17/init.c, spintrcritical17/Makefile.am,
spintrcritical17/spintrcritical17.doc,
spintrcritical17/spintrcritical17.scn: New files.
* Makefile.am, configure.ac: Update for test sp68 and spintrcritical17.
* sp31/task1.c, sp67/init.c: Changes for new timer server
implementation.
* sp52/init.c: The init task must be preemptible to let the timer
server run.
2009-11-23 Joel Sherrill <joel.sherrill@oarcorp.com>
PR 1460/cpukit

View File

@@ -13,7 +13,7 @@ SUBDIRS = \
sp30 sp31 sp32 sp33 sp34 sp35 sp37 sp38 sp39 \
sp40 sp41 sp42 sp43 sp44 sp45 sp46 sp47 sp48 sp49 \
sp50 sp51 sp52 sp53 sp54 sp55 sp56 sp57 sp58 sp59 \
sp60 sp61 sp62 sp63 sp64 sp65 sp66 sp67 \
sp60 sp61 sp62 sp63 sp64 sp65 sp66 sp67 sp68 \
spchain spclockget spcoverage spobjgetnext spnotepad01 spprintk spsize \
spstkalloc spthreadq01 spwatchdog spwkspace \
spfatal01 spfatal02 spfatal03 spfatal04 spfatal05 spfatal06 spfatal07 \
@@ -21,7 +21,8 @@ SUBDIRS = \
spintrcritical01 spintrcritical02 spintrcritical03 spintrcritical04 \
spintrcritical05 spintrcritical06 spintrcritical07 spintrcritical08 \
spintrcritical09 spintrcritical10 spintrcritical11 spintrcritical12 \
spintrcritical13 spintrcritical14 spintrcritical15 spintrcritical16
spintrcritical13 spintrcritical14 spintrcritical15 spintrcritical16 \
spintrcritical17
DIST_SUBDIRS = $(SUBDIRS) spfatal_support spintrcritical_support
EXTRA_DIST = spfatal_support/init.c spfatal_support/system.h

View File

@@ -93,6 +93,7 @@ sp64/Makefile
sp65/Makefile
sp66/Makefile
sp67/Makefile
sp68/Makefile
spchain/Makefile
spclockget/Makefile
spcoverage/Makefile
@@ -124,6 +125,7 @@ spintrcritical13/Makefile
spintrcritical14/Makefile
spintrcritical15/Makefile
spintrcritical16/Makefile
spintrcritical17/Makefile
spnotepad01/Makefile
spobjgetnext/Makefile
spprintk/Makefile

View File

@@ -35,6 +35,14 @@ rtems_timer_service_routine Should_not_fire_TSR(
TSR_fired = 1;
}
static Watchdog_Interval schedule_time( void )
{
const Watchdog_Control *watchdog =
&_Timer_server->Interval_watchdogs.System_watchdog;
return watchdog->initial + watchdog->start_time;
}
rtems_task Task_1(
rtems_task_argument argument
)
@@ -105,7 +113,7 @@ rtems_task Task_1(
printf( "Timer 1 scheduled for %" PRIdWatchdog_Interval " ticks since boot\n",
info.start_time + info.initial );
printf( "Timer Server scheduled for %" PRIdWatchdog_Interval " ticks since boot\n",
_Timer_Server->Timer.initial + _Timer_Server->Timer.start_time );
schedule_time() );
puts( "TA1 - rtems_task_wake_after - 1 second" );
status = rtems_task_wake_after( 1 * rtems_clock_get_ticks_per_second() );
@@ -121,9 +129,8 @@ rtems_task Task_1(
printf( "Timer 1 scheduled for %" PRIdWatchdog_Interval " ticks since boot\n",
info.start_time + info.initial );
printf( "Timer Server scheduled for %" PRIdWatchdog_Interval " ticks since boot\n",
_Timer_Server->Timer.initial + _Timer_Server->Timer.start_time );
assert( (info.start_time + info.initial) ==
(_Timer_Server->Timer.initial + _Timer_Server->Timer.start_time) );
schedule_time() );
assert( (info.start_time + info.initial) == schedule_time() );
puts( "TA1 - rtems_task_wake_after - 1 second" );
status = rtems_task_wake_after( 1 * rtems_clock_get_ticks_per_second() );
@@ -139,9 +146,8 @@ rtems_task Task_1(
printf( "Timer 1 scheduled for %" PRIdWatchdog_Interval " ticks since boot\n",
info.start_time + info.initial );
printf( "Timer Server scheduled for %" PRIdWatchdog_Interval " ticks since boot\n",
_Timer_Server->Timer.initial + _Timer_Server->Timer.start_time );
assert( (info.start_time + info.initial) ==
(_Timer_Server->Timer.initial + _Timer_Server->Timer.start_time) );
schedule_time() );
assert( (info.start_time + info.initial) == schedule_time() );
puts( "TA1 - rtems_timer_cancel - timer 1" );
status = rtems_timer_cancel( tmid );

View File

@@ -112,5 +112,8 @@ rtems_task Init(
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_INIT_TASK_PRIORITY (RTEMS_MINIMUM_PRIORITY + 1)
#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES
#define CONFIGURE_INIT
#include <rtems/confdefs.h>

View File

@@ -54,6 +54,9 @@ rtems_task Init(
status = rtems_timer_create( rtems_build_name('T', 'M', '2', ' '), &timer2 );
directive_failed( status, "rtems_timer_create #1" );
/* Manipulate the time */
_Watchdog_Ticks_since_boot = (Watchdog_Interval) -15;
/* initiate timer server */
puts( "Init - Initiate the timer server" );
status = rtems_timer_initiate_server(
@@ -63,35 +66,27 @@ rtems_task Init(
);
directive_failed( status, "rtems_timer_initiate_server" );
/* Give the timer server some time to initialize */
status = rtems_task_wake_after( 10 );
directive_failed( status, "task wake_after" );
status = rtems_timer_server_fire_after(
timer1,
0xffff,
10,
TIMER_service_routine,
(void*) &_timer_passage_1
);
directive_failed( status, "rtems_timer_server_fire_after" );
/* Make the timer server think that the ticks has wrapped */
_Timer_Server_ticks_last_time = 100;
status = rtems_task_wake_after( 10 );
directive_failed( status, "task wake_after" );
/* Make the timer server think that the ticks has wrapped */
_Timer_Server_ticks_last_time = 200;
status = rtems_timer_server_fire_after(
timer2,
0xffff,
20,
TIMER_service_routine,
(void*) &_timer_passage_2
);
directive_failed( status, "rtems_timer_server_fire_after" );
status = rtems_task_wake_after( 10 );
status = rtems_task_wake_after( 15 );
directive_failed( status, "task wake_after" );
if (!_timer_passage_1) {

View File

@@ -0,0 +1,28 @@
##
## $Id$
##
MANAGERS = all
rtems_tests_PROGRAMS = sp68
sp68_SOURCES = init.c
dist_rtems_tests_DATA = sp68.scn
dist_rtems_tests_DATA += sp68.doc
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../automake/compile.am
include $(top_srcdir)/../automake/leaf.am
sp68_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
AM_CPPFLAGS += -I$(top_srcdir)/../support/include
LINK_OBJS = $(sp68_OBJECTS) $(sp68_LDADD)
LINK_LIBS = $(sp68_LDLIBS)
sp68$(EXEEXT): $(sp68_OBJECTS) $(sp68_DEPENDENCIES)
@rm -f sp68$(EXEEXT)
$(make-exe)
include $(top_srcdir)/../automake/local.am

View File

@@ -0,0 +1,574 @@
# Makefile.in generated by automake 1.11 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
rtems_tests_PROGRAMS = sp68$(EXEEXT)
DIST_COMMON = $(dist_rtems_tests_DATA) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(top_srcdir)/../automake/compile.am \
$(top_srcdir)/../automake/leaf.am \
$(top_srcdir)/../automake/local.am
subdir = sp68
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = \
$(top_srcdir)/../aclocal/canonical-target-name.m4 \
$(top_srcdir)/../aclocal/canonicalize-tools.m4 \
$(top_srcdir)/../aclocal/check-custom-bsp.m4 \
$(top_srcdir)/../aclocal/check-tool.m4 \
$(top_srcdir)/../aclocal/env-rtemsbsp.m4 \
$(top_srcdir)/../aclocal/prog-cc.m4 \
$(top_srcdir)/../aclocal/project-root.m4 \
$(top_srcdir)/../aclocal/rtems-test-no-pause.m4 \
$(top_srcdir)/../aclocal/rtems-top.m4 \
$(top_srcdir)/../aclocal/version.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(rtems_testsdir)" \
"$(DESTDIR)$(rtems_testsdir)"
PROGRAMS = $(rtems_tests_PROGRAMS)
am_sp68_OBJECTS = init.$(OBJEXT)
sp68_OBJECTS = $(am_sp68_OBJECTS)
sp68_DEPENDENCIES = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
DEFAULT_INCLUDES = -I.@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/../../depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(sp68_SOURCES)
DIST_SOURCES = $(sp68_SOURCES)
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
DATA = $(dist_rtems_tests_DATA)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@ $(GCCSPECS)
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@ $(GCCSPECS)
CPPFLAGS = @CPPFLAGS@
CPUKIT_ROOT = @CPUKIT_ROOT@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
ENDIF = @ENDIF@
EXEEXT = @EXEEXT@
GCCSPECS = @GCCSPECS@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKE = @MAKE@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NM = @NM@
OBJCOPY = @OBJCOPY@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PACKHEX = @PACKHEX@
PATH_SEPARATOR = @PATH_SEPARATOR@
PROJECT_INCLUDE = @PROJECT_INCLUDE@
PROJECT_LIB = @PROJECT_LIB@
PROJECT_RELEASE = @PROJECT_RELEASE@
PROJECT_ROOT = @PROJECT_ROOT@
PROJECT_TOPdir = @PROJECT_TOPdir@
RANLIB = @RANLIB@
RTEMS_BSP = @RTEMS_BSP@
RTEMS_BSP_FAMILY = @RTEMS_BSP_FAMILY@
RTEMS_CPU = @RTEMS_CPU@
RTEMS_ROOT = @RTEMS_ROOT@
RTEMS_TOPdir = @RTEMS_TOPdir@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SIZE = @SIZE@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
rtems_testsdir = @rtems_testsdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
MANAGERS = all
sp68_SOURCES = init.c
dist_rtems_tests_DATA = sp68.scn sp68.doc
CXX = @CXX@ $(GCCSPECS)
AM_CPPFLAGS = -I$(top_srcdir)/../support/include
AM_CFLAGS =
AM_CXXFLAGS =
CXXLINK_APP = $(CXXLINK) $(LDLIBS) $(LINK_OBJS) $(LINK_LIBS)
LINK_APP = $(LINK) $(LDLIBS) $(LINK_OBJS) $(LINK_LIBS)
sp68_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
LINK_OBJS = $(sp68_OBJECTS) $(sp68_LDADD)
LINK_LIBS = $(sp68_LDLIBS)
PROJECT_TOOLS = $(PROJECT_RELEASE)/build-tools
all: all-am
.SUFFIXES:
.SUFFIXES: .c .o .obj
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/../automake/compile.am $(top_srcdir)/../automake/leaf.am $(top_srcdir)/../automake/local.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign sp68/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign sp68/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-rtems_testsPROGRAMS: $(rtems_tests_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(rtems_testsdir)" || $(MKDIR_P) "$(DESTDIR)$(rtems_testsdir)"
@list='$(rtems_tests_PROGRAMS)'; test -n "$(rtems_testsdir)" || list=; \
for p in $$list; do echo "$$p $$p"; done | \
sed 's/$(EXEEXT)$$//' | \
while read p p1; do if test -f $$p; \
then echo "$$p"; echo "$$p"; else :; fi; \
done | \
sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
sed 'N;N;N;s,\n, ,g' | \
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
if ($$2 == $$4) files[d] = files[d] " " $$1; \
else { print "f", $$3 "/" $$4, $$1; } } \
END { for (d in files) print "f", d, files[d] }' | \
while read type dir files; do \
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
test -z "$$files" || { \
echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(rtems_testsdir)$$dir'"; \
$(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(rtems_testsdir)$$dir" || exit $$?; \
} \
; done
uninstall-rtems_testsPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(rtems_tests_PROGRAMS)'; test -n "$(rtems_testsdir)" || list=; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-e 's/$$/$(EXEEXT)/' `; \
test -n "$$list" || exit 0; \
echo " ( cd '$(DESTDIR)$(rtems_testsdir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(rtems_testsdir)" && rm -f $$files
clean-rtems_testsPROGRAMS:
-test -z "$(rtems_tests_PROGRAMS)" || rm -f $(rtems_tests_PROGRAMS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/init.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
install-dist_rtems_testsDATA: $(dist_rtems_tests_DATA)
@$(NORMAL_INSTALL)
test -z "$(rtems_testsdir)" || $(MKDIR_P) "$(DESTDIR)$(rtems_testsdir)"
@list='$(dist_rtems_tests_DATA)'; test -n "$(rtems_testsdir)" || list=; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(rtems_testsdir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(rtems_testsdir)" || exit $$?; \
done
uninstall-dist_rtems_testsDATA:
@$(NORMAL_UNINSTALL)
@list='$(dist_rtems_tests_DATA)'; test -n "$(rtems_testsdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(rtems_testsdir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(rtems_testsdir)" && rm -f $$files
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS) $(DATA)
installdirs:
for dir in "$(DESTDIR)$(rtems_testsdir)" "$(DESTDIR)$(rtems_testsdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-local clean-rtems_testsPROGRAMS \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-dist_rtems_testsDATA \
install-rtems_testsPROGRAMS
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-dist_rtems_testsDATA \
uninstall-rtems_testsPROGRAMS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-local clean-rtems_testsPROGRAMS ctags distclean \
distclean-compile distclean-generic distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-dist_rtems_testsDATA \
install-dvi install-dvi-am install-exec install-exec-am \
install-html install-html-am install-info install-info-am \
install-man install-pdf install-pdf-am install-ps \
install-ps-am install-rtems_testsPROGRAMS install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
uninstall-am uninstall-dist_rtems_testsDATA \
uninstall-rtems_testsPROGRAMS
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
clean-local:
$(RM) *.num *.nxe *.elf *.srec* *.bin *.bt *.ralf
include $(RTEMS_ROOT)/make/leaf.cfg
ifndef make-cxx-exe
define make-cxx-exe
$(CXXLINK_APP)
endef
@ENDIF@
ifndef make-exe
define make-exe
$(LINK_APP)
endef
@ENDIF@
sp68$(EXEEXT): $(sp68_OBJECTS) $(sp68_DEPENDENCIES)
@rm -f sp68$(EXEEXT)
$(make-exe)
preinstall:
.PHONY: preinstall
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@@ -0,0 +1,467 @@
/**
* @file
*
* @ingroup sptests
*
* @brief Test for timer server with blocking calls.
*/
/*
* 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
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#include <tmacros.h>
#define TIMER_COUNT 6
#define OBTAIN 0
#define RELEASE 1
#define INTERRUPT 2
#define DELAYED 3
#define SERVER_TRIGGERED 4
#define INTERRUPT_TRIGGERED 5
#define T0 0
#define T1 1
#define T2 2
#define T3 3
#define T4 4
#define T5 5
#define T6 6
static volatile bool obtain_try;
static volatile bool obtain_done;
static volatile bool release_happend;
static volatile bool interrupt_happend;
static volatile bool delayed_happend;
static volatile bool server_triggered_happend;
static volatile bool interrupt_triggered_happend;
static rtems_id timer [TIMER_COUNT];
static rtems_id semaphore;
static rtems_id mutex;
static rtems_id message_queue;
static rtems_id region;
static rtems_id barrier;
static void *region_item;
static rtems_interval start;
static volatile enum resource_type {
SEMAPHORE = 0,
MUTEX,
MESSAGE_QUEUE,
REGION,
EVENT,
BARRIER,
TASK_WAKE_AFTER
} resource_type;
static const char *resource_type_desc [] = {
"SEMAPHORE",
"MUTEX",
"MESSAGE QUEUE",
"REGION",
"EVENT",
"BARRIER",
"TASK WAKE AFTER"
};
static void assert_time(rtems_interval expected)
{
rtems_test_assert((rtems_clock_get_ticks_since_boot() - start) == expected);
}
static void obtain_callback(rtems_id timer_id, void *arg)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
char buf [1];
size_t size = sizeof(buf);
void *new_region_item = NULL;
rtems_event_set events = 0;
assert_time(T1);
rtems_test_assert(
!release_happend
&& !interrupt_happend
&& !delayed_happend
&& !interrupt_triggered_happend
&& !server_triggered_happend
);
obtain_try = true;
switch (resource_type) {
case SEMAPHORE:
sc = rtems_semaphore_obtain(semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
break;
case MUTEX:
sc = rtems_semaphore_obtain(mutex, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
break;
case MESSAGE_QUEUE:
sc = rtems_message_queue_receive(message_queue, buf, &size, RTEMS_WAIT, RTEMS_NO_TIMEOUT);
break;
case REGION:
sc = rtems_region_get_segment(region, 1, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &new_region_item);
break;
case EVENT:
sc = rtems_event_receive(RTEMS_EVENT_0, RTEMS_EVENT_ALL | RTEMS_WAIT, RTEMS_NO_TIMEOUT, &events);
break;
case BARRIER:
sc = rtems_barrier_wait(barrier, RTEMS_NO_TIMEOUT);
break;
case TASK_WAKE_AFTER:
sc = rtems_task_wake_after(T4 - T1);
break;
default:
rtems_test_assert(false);
break;
}
directive_failed(sc, "obtain");
obtain_done = true;
}
static void release_callback(rtems_id timer_id, void *arg)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
char buf [1];
size_t size = sizeof(buf);
uint32_t released = 0;
assert_time(T4);
rtems_test_assert(
obtain_try
&& interrupt_happend
&& !delayed_happend
&& !interrupt_triggered_happend
&& !server_triggered_happend
);
switch (resource_type) {
case SEMAPHORE:
sc = rtems_semaphore_release(semaphore);
break;
case MUTEX:
sc = rtems_semaphore_release(mutex);
break;
case MESSAGE_QUEUE:
sc = rtems_message_queue_send(message_queue, buf, size);
break;
case EVENT:
sc = rtems_event_send(_Timer_server->thread->Object.id, RTEMS_EVENT_0);
break;
case BARRIER:
sc = rtems_barrier_release(barrier, &released);
break;
case TASK_WAKE_AFTER:
sc = RTEMS_SUCCESSFUL;
break;
default:
rtems_test_assert(false);
break;
}
directive_failed_with_level(sc, "release", 1);
release_happend = true;
}
static void interrupt_triggered_callback(rtems_id timer_id, void *arg)
{
/*
* This callback is scheduled to fire at T3, but is delayed due to the
* blocked obtain callback.
*/
assert_time(T4);
rtems_test_assert(
obtain_done
&& release_happend
&& interrupt_happend
&& !server_triggered_happend
);
interrupt_triggered_happend = true;
}
static void interrupt_callback(rtems_id timer_id, void *arg)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
assert_time(T2);
rtems_test_assert(
obtain_try
&& !obtain_done
&& !release_happend
&& !delayed_happend
&& !interrupt_triggered_happend
&& !server_triggered_happend
);
sc = rtems_timer_server_fire_after(
timer [INTERRUPT_TRIGGERED],
T3 - T2,
interrupt_triggered_callback,
NULL
);
directive_failed_with_level(sc, "rtems_timer_server_fire_after", -1);
interrupt_happend = true;
}
static void server_triggered_callback(rtems_id timer_id, void *arg)
{
assert_time(T5);
rtems_test_assert(
obtain_done
&& release_happend
&& interrupt_happend
&& delayed_happend
&& interrupt_triggered_happend
);
server_triggered_happend = true;
}
static void delayed_callback(rtems_id timer_id, void *arg)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
assert_time(T4);
rtems_test_assert(
obtain_done
&& release_happend
&& interrupt_happend
&& !server_triggered_happend
);
sc = rtems_timer_server_fire_after(
timer [SERVER_TRIGGERED],
T5 - T4,
server_triggered_callback,
NULL
);
directive_failed(sc, "rtems_timer_server_fire_after");
delayed_happend = true;
}
static void test_reset(void)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
obtain_try = false;
obtain_done = false;
release_happend = false;
interrupt_happend = false;
delayed_happend = false;
interrupt_triggered_happend = false;
server_triggered_happend = false;
/* Synchronize with tick */
sc = rtems_task_wake_after(1);
directive_failed(sc, "rtems_task_wake_after");
start = rtems_clock_get_ticks_since_boot();
}
static void test_case(enum resource_type rt)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
printf("test case: %s\n", resource_type_desc [rt]);
resource_type = rt;
test_reset();
sc = rtems_timer_server_fire_after(
timer [OBTAIN],
T1 - T0,
obtain_callback,
NULL
);
directive_failed(sc, "rtems_timer_server_fire_after");
sc = rtems_timer_fire_after(
timer [INTERRUPT],
T2 - T0,
interrupt_callback,
NULL
);
directive_failed(sc, "rtems_timer_fire_after");
sc = rtems_timer_server_fire_after(
timer [DELAYED],
T3 - T0,
delayed_callback,
NULL
);
directive_failed(sc, "rtems_timer_server_fire_after");
if (resource_type != REGION) {
sc = rtems_timer_fire_after(
timer [RELEASE],
T4 - T0,
release_callback,
NULL
);
directive_failed(sc, "rtems_timer_fire_after");
assert_time(T0);
sc = rtems_task_wake_after(T6 - T0);
directive_failed(sc, "task_wake_after");
} else {
sc = rtems_task_wake_after(T4 - T0);
directive_failed(sc, "task_wake_after");
assert_time(T4);
rtems_test_assert(
obtain_try
&& interrupt_happend
&& !delayed_happend
&& !interrupt_triggered_happend
&& !server_triggered_happend
);
sc = rtems_region_return_segment(region, region_item);
directive_failed(sc, "rtems_region_return_segment");
release_happend = true;
sc = rtems_task_wake_after(T6 - T4);
directive_failed(sc, "task_wake_after");
}
assert_time(T6);
rtems_test_assert(
obtain_done
&& interrupt_happend
&& release_happend
&& delayed_happend
&& interrupt_triggered_happend
&& server_triggered_happend
);
}
rtems_task Init(rtems_task_argument argument)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
char region_area [128];
enum resource_type rt = SEMAPHORE;
void *new_region_item = NULL;
size_t i = 0;
puts("\n\n*** TEST 68 ***");
for (i = 0; i < TIMER_COUNT; ++i) {
sc = rtems_timer_create(
rtems_build_name('T', 'I', 'M', '0' + i),
&timer [i]
);
directive_failed(sc, "rtems_timer_create");
}
sc = rtems_timer_initiate_server(
RTEMS_MINIMUM_PRIORITY,
RTEMS_MINIMUM_STACK_SIZE,
RTEMS_DEFAULT_ATTRIBUTES
);
directive_failed(sc, "rtems_timer_initiate_server");
sc = rtems_semaphore_create(
rtems_build_name('S', 'E', 'M', 'A'),
0,
RTEMS_LOCAL | RTEMS_FIFO | RTEMS_COUNTING_SEMAPHORE,
0,
&semaphore
);
directive_failed(sc, "rtems_semaphore_create");
sc = rtems_semaphore_create(
rtems_build_name('M', 'U', 'T', 'X'),
0,
RTEMS_LOCAL | RTEMS_FIFO | RTEMS_SIMPLE_BINARY_SEMAPHORE,
0,
&mutex
);
directive_failed(sc, "rtems_semaphore_create");
sc = rtems_message_queue_create(
rtems_build_name('M', 'S', 'G', 'Q'),
1,
1,
RTEMS_LOCAL | RTEMS_FIFO,
&message_queue
);
directive_failed(sc, "rtems_message_queue_create");
sc = rtems_region_create(
rtems_build_name('R', 'E', 'G', 'I'),
region_area,
sizeof(region_area),
1,
RTEMS_LOCAL | RTEMS_FIFO,
&region
);
directive_failed(sc, "rtems_region_create");
do {
region_item = new_region_item;
sc = rtems_region_get_segment(region, 1, RTEMS_NO_WAIT, 0, &new_region_item);
} while (sc == RTEMS_SUCCESSFUL);
sc = rtems_barrier_create(
rtems_build_name('B', 'A', 'R', 'R'),
RTEMS_LOCAL | RTEMS_FIFO,
2,
&barrier
);
directive_failed(sc, "rtems_barrier_create");
while (rt <= TASK_WAKE_AFTER) {
test_case(rt);
++rt;
}
puts("*** END OF TEST 68 ***");
rtems_test_exit(0);
}
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_MAXIMUM_TASKS 2
#define CONFIGURE_MAXIMUM_TIMERS TIMER_COUNT
#define CONFIGURE_MAXIMUM_SEMAPHORES 2
#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1
#define CONFIGURE_MAXIMUM_REGIONS 1
#define CONFIGURE_MAXIMUM_BARRIERS 1
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_INIT
#include <rtems/confdefs.h>

View File

@@ -0,0 +1,21 @@
#
# $Id$
#
# 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.
#
This file describes the directives and concepts tested by this test set.
test set name: sp68
directives:
rtems_timer_server_fire_after
concepts:
+ Ensure that the default timer server can cope with blocking calls.

View File

@@ -0,0 +1,9 @@
*** TEST 68 ***
test case: SEMAPHORE
test case: MUTEX
test case: MESSAGE QUEUE
test case: REGION
test case: EVENT
test case: BARRIER
test case: TASK WAKE AFTER
*** END OF TEST 68 ***

View File

@@ -0,0 +1,30 @@
##
## $Id$
##
MANAGERS = all
rtems_tests_PROGRAMS = spintrcritical17
spintrcritical17_SOURCES = init.c \
../spintrcritical_support/intrcritical.c
dist_rtems_tests_DATA = spintrcritical17.scn
dist_rtems_tests_DATA += spintrcritical17.doc
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
include $(top_srcdir)/../automake/compile.am
include $(top_srcdir)/../automake/leaf.am
spintrcritical17_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
AM_CPPFLAGS += -I$(top_srcdir)/../support/include
AM_CPPFLAGS += -I$(top_srcdir)/spintrcritical_support
LINK_OBJS = $(spintrcritical17_OBJECTS) $(spintrcritical17_LDADD)
LINK_LIBS = $(spintrcritical17_LDLIBS)
spintrcritical17$(EXEEXT): $(spintrcritical17_OBJECTS) $(spintrcritical17_DEPENDENCIES)
@rm -f spintrcritical17$(EXEEXT)
$(make-exe)
include $(top_srcdir)/../automake/local.am

View File

@@ -0,0 +1,593 @@
# Makefile.in generated by automake 1.11 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
INSTALL_HEADER = $(INSTALL_DATA)
transform = $(program_transform_name)
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
rtems_tests_PROGRAMS = spintrcritical17$(EXEEXT)
DIST_COMMON = $(dist_rtems_tests_DATA) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(top_srcdir)/../automake/compile.am \
$(top_srcdir)/../automake/leaf.am \
$(top_srcdir)/../automake/local.am
subdir = spintrcritical17
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = \
$(top_srcdir)/../aclocal/canonical-target-name.m4 \
$(top_srcdir)/../aclocal/canonicalize-tools.m4 \
$(top_srcdir)/../aclocal/check-custom-bsp.m4 \
$(top_srcdir)/../aclocal/check-tool.m4 \
$(top_srcdir)/../aclocal/env-rtemsbsp.m4 \
$(top_srcdir)/../aclocal/prog-cc.m4 \
$(top_srcdir)/../aclocal/project-root.m4 \
$(top_srcdir)/../aclocal/rtems-test-no-pause.m4 \
$(top_srcdir)/../aclocal/rtems-top.m4 \
$(top_srcdir)/../aclocal/version.m4 $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(rtems_testsdir)" \
"$(DESTDIR)$(rtems_testsdir)"
PROGRAMS = $(rtems_tests_PROGRAMS)
am_spintrcritical17_OBJECTS = init.$(OBJEXT) intrcritical.$(OBJEXT)
spintrcritical17_OBJECTS = $(am_spintrcritical17_OBJECTS)
spintrcritical17_DEPENDENCIES = \
$(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
DEFAULT_INCLUDES = -I.@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/../../depcomp
am__depfiles_maybe = depfiles
am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(spintrcritical17_SOURCES)
DIST_SOURCES = $(spintrcritical17_SOURCES)
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
DATA = $(dist_rtems_tests_DATA)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
AS = @AS@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
CC = @CC@ $(GCCSPECS)
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@ $(GCCSPECS)
CPPFLAGS = @CPPFLAGS@
CPUKIT_ROOT = @CPUKIT_ROOT@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
ENDIF = @ENDIF@
EXEEXT = @EXEEXT@
GCCSPECS = @GCCSPECS@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
LD = @LD@
LDFLAGS = @LDFLAGS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKE = @MAKE@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
NM = @NM@
OBJCOPY = @OBJCOPY@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PACKHEX = @PACKHEX@
PATH_SEPARATOR = @PATH_SEPARATOR@
PROJECT_INCLUDE = @PROJECT_INCLUDE@
PROJECT_LIB = @PROJECT_LIB@
PROJECT_RELEASE = @PROJECT_RELEASE@
PROJECT_ROOT = @PROJECT_ROOT@
PROJECT_TOPdir = @PROJECT_TOPdir@
RANLIB = @RANLIB@
RTEMS_BSP = @RTEMS_BSP@
RTEMS_BSP_FAMILY = @RTEMS_BSP_FAMILY@
RTEMS_CPU = @RTEMS_CPU@
RTEMS_ROOT = @RTEMS_ROOT@
RTEMS_TOPdir = @RTEMS_TOPdir@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SIZE = @SIZE@
STRIP = @STRIP@
VERSION = @VERSION@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
am__tar = @am__tar@
am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
host_os = @host_os@
host_vendor = @host_vendor@
htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
rtems_testsdir = @rtems_testsdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
MANAGERS = all
spintrcritical17_SOURCES = init.c \
../spintrcritical_support/intrcritical.c
dist_rtems_tests_DATA = spintrcritical17.scn spintrcritical17.doc
CXX = @CXX@ $(GCCSPECS)
AM_CPPFLAGS = -I$(top_srcdir)/../support/include \
-I$(top_srcdir)/spintrcritical_support
AM_CFLAGS =
AM_CXXFLAGS =
CXXLINK_APP = $(CXXLINK) $(LDLIBS) $(LINK_OBJS) $(LINK_LIBS)
LINK_APP = $(LINK) $(LDLIBS) $(LINK_OBJS) $(LINK_LIBS)
spintrcritical17_LDADD = $(MANAGERS_NOT_WANTED:%=$(PROJECT_LIB)/no-%.rel)
LINK_OBJS = $(spintrcritical17_OBJECTS) $(spintrcritical17_LDADD)
LINK_LIBS = $(spintrcritical17_LDLIBS)
PROJECT_TOOLS = $(PROJECT_RELEASE)/build-tools
all: all-am
.SUFFIXES:
.SUFFIXES: .c .o .obj
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/../automake/compile.am $(top_srcdir)/../automake/leaf.am $(top_srcdir)/../automake/local.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
&& { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign spintrcritical17/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign spintrcritical17/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
*) \
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
install-rtems_testsPROGRAMS: $(rtems_tests_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(rtems_testsdir)" || $(MKDIR_P) "$(DESTDIR)$(rtems_testsdir)"
@list='$(rtems_tests_PROGRAMS)'; test -n "$(rtems_testsdir)" || list=; \
for p in $$list; do echo "$$p $$p"; done | \
sed 's/$(EXEEXT)$$//' | \
while read p p1; do if test -f $$p; \
then echo "$$p"; echo "$$p"; else :; fi; \
done | \
sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
-e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
sed 'N;N;N;s,\n, ,g' | \
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
if ($$2 == $$4) files[d] = files[d] " " $$1; \
else { print "f", $$3 "/" $$4, $$1; } } \
END { for (d in files) print "f", d, files[d] }' | \
while read type dir files; do \
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
test -z "$$files" || { \
echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(rtems_testsdir)$$dir'"; \
$(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(rtems_testsdir)$$dir" || exit $$?; \
} \
; done
uninstall-rtems_testsPROGRAMS:
@$(NORMAL_UNINSTALL)
@list='$(rtems_tests_PROGRAMS)'; test -n "$(rtems_testsdir)" || list=; \
files=`for p in $$list; do echo "$$p"; done | \
sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
-e 's/$$/$(EXEEXT)/' `; \
test -n "$$list" || exit 0; \
echo " ( cd '$(DESTDIR)$(rtems_testsdir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(rtems_testsdir)" && rm -f $$files
clean-rtems_testsPROGRAMS:
-test -z "$(rtems_tests_PROGRAMS)" || rm -f $(rtems_tests_PROGRAMS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/init.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/intrcritical.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
intrcritical.o: ../spintrcritical_support/intrcritical.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT intrcritical.o -MD -MP -MF $(DEPDIR)/intrcritical.Tpo -c -o intrcritical.o `test -f '../spintrcritical_support/intrcritical.c' || echo '$(srcdir)/'`../spintrcritical_support/intrcritical.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/intrcritical.Tpo $(DEPDIR)/intrcritical.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../spintrcritical_support/intrcritical.c' object='intrcritical.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o intrcritical.o `test -f '../spintrcritical_support/intrcritical.c' || echo '$(srcdir)/'`../spintrcritical_support/intrcritical.c
intrcritical.obj: ../spintrcritical_support/intrcritical.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT intrcritical.obj -MD -MP -MF $(DEPDIR)/intrcritical.Tpo -c -o intrcritical.obj `if test -f '../spintrcritical_support/intrcritical.c'; then $(CYGPATH_W) '../spintrcritical_support/intrcritical.c'; else $(CYGPATH_W) '$(srcdir)/../spintrcritical_support/intrcritical.c'; fi`
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/intrcritical.Tpo $(DEPDIR)/intrcritical.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../spintrcritical_support/intrcritical.c' object='intrcritical.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o intrcritical.obj `if test -f '../spintrcritical_support/intrcritical.c'; then $(CYGPATH_W) '../spintrcritical_support/intrcritical.c'; else $(CYGPATH_W) '$(srcdir)/../spintrcritical_support/intrcritical.c'; fi`
install-dist_rtems_testsDATA: $(dist_rtems_tests_DATA)
@$(NORMAL_INSTALL)
test -z "$(rtems_testsdir)" || $(MKDIR_P) "$(DESTDIR)$(rtems_testsdir)"
@list='$(dist_rtems_tests_DATA)'; test -n "$(rtems_testsdir)" || list=; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(rtems_testsdir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(rtems_testsdir)" || exit $$?; \
done
uninstall-dist_rtems_testsDATA:
@$(NORMAL_UNINSTALL)
@list='$(dist_rtems_tests_DATA)'; test -n "$(rtems_testsdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(rtems_testsdir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(rtems_testsdir)" && rm -f $$files
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
dist_files=`for file in $$list; do echo $$file; done | \
sed -e "s|^$$srcdirstrip/||;t" \
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
case $$dist_files in \
*/*) $(MKDIR_P) `echo "$$dist_files" | \
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
sort -u` ;; \
esac; \
for file in $$dist_files; do \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS) $(DATA)
installdirs:
for dir in "$(DESTDIR)$(rtems_testsdir)" "$(DESTDIR)$(rtems_testsdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
uninstall: uninstall-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
installcheck: installcheck-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-generic clean-local clean-rtems_testsPROGRAMS \
mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
distclean-tags
dvi: dvi-am
dvi-am:
html: html-am
html-am:
info: info-am
info-am:
install-data-am: install-dist_rtems_testsDATA \
install-rtems_testsPROGRAMS
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
-rm -f Makefile
maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
mostlyclean-am: mostlyclean-compile mostlyclean-generic
pdf: pdf-am
pdf-am:
ps: ps-am
ps-am:
uninstall-am: uninstall-dist_rtems_testsDATA \
uninstall-rtems_testsPROGRAMS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-local clean-rtems_testsPROGRAMS ctags distclean \
distclean-compile distclean-generic distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
install-data install-data-am install-dist_rtems_testsDATA \
install-dvi install-dvi-am install-exec install-exec-am \
install-html install-html-am install-info install-info-am \
install-man install-pdf install-pdf-am install-ps \
install-ps-am install-rtems_testsPROGRAMS install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
uninstall-am uninstall-dist_rtems_testsDATA \
uninstall-rtems_testsPROGRAMS
include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP@.cfg
clean-local:
$(RM) *.num *.nxe *.elf *.srec* *.bin *.bt *.ralf
include $(RTEMS_ROOT)/make/leaf.cfg
ifndef make-cxx-exe
define make-cxx-exe
$(CXXLINK_APP)
endef
@ENDIF@
ifndef make-exe
define make-exe
$(LINK_APP)
endef
@ENDIF@
spintrcritical17$(EXEEXT): $(spintrcritical17_OBJECTS) $(spintrcritical17_DEPENDENCIES)
@rm -f spintrcritical17$(EXEEXT)
$(make-exe)
preinstall:
.PHONY: preinstall
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@@ -0,0 +1,131 @@
/*
* COPYRIGHT (c) 1989-2009.
* 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>
#include <intrcritical.h>
static rtems_id timer_0;
static rtems_id timer_1;
static rtems_id timer_2;
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)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
sc = rtems_timer_reset(timer_0);
directive_failed_with_level(sc, "rtems_timer_reset", -1);
sc = rtems_timer_reset(timer_1);
directive_failed_with_level(sc, "rtems_timer_reset", -1);
if (!case_hit) {
case_hit = _Timer_server->insert_chain != NULL;
}
}
static void trigger_callback(rtems_id timer, void *arg)
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
if (case_hit) {
puts("*** END OF INTERRUPT CRITICAL SECTION 17 ***");
rtems_test_exit(0);
} else if (interrupt_critical_section_test_support_delay()) {
puts("test case not hit, give up");
rtems_test_exit(0);
}
sc = rtems_timer_reset(timer_2);
directive_failed(sc, "rtems_timer_reset");
}
rtems_task Init( rtems_task_argument ignored )
{
rtems_status_code sc = RTEMS_SUCCESSFUL;
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");
sc = rtems_timer_create(
rtems_build_name('T', 'I', 'M', '1'),
&timer_1
);
directive_failed(sc, "rtems_timer_create");
sc = rtems_timer_create(
rtems_build_name('T', 'I', 'M', '2'),
&timer_2
);
directive_failed(sc, "rtems_timer_create");
sc = rtems_timer_initiate_server(
RTEMS_MINIMUM_PRIORITY,
RTEMS_MINIMUM_STACK_SIZE,
RTEMS_DEFAULT_ATTRIBUTES
);
directive_failed(sc, "rtems_timer_initiate_server");
sc = rtems_timer_server_fire_after(
timer_0,
2,
never_callback,
NULL
);
directive_failed(sc, "rtems_timer_server_fire_after");
sc = rtems_timer_fire_after(
timer_1,
1,
reset_callback,
NULL
);
directive_failed(sc, "rtems_timer_fire_after");
sc = rtems_timer_server_fire_after(
timer_2,
1,
trigger_callback,
NULL
);
directive_failed(sc, "rtems_timer_server_fire_after");
interrupt_critical_section_test_support_initialize(NULL);
rtems_task_delete(RTEMS_SELF);
}
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_MICROSECONDS_PER_TICK 1000
#define CONFIGURE_MAXIMUM_TASKS 2
#define CONFIGURE_MAXIMUM_TIMERS 3
#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_INIT
#include <rtems/confdefs.h>

View File

@@ -0,0 +1,23 @@
#
# $Id$
#
# 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.
#
This file describes the directives and concepts tested by this test set.
test set name: spintrcritical17
directives:
_Timer_server_Get_watchdogs_that_fire_now
_Timer_server_Schedule_operation_method
_Timer_server_Process_insertions
concepts:
+ Test critical sections which are only accessible through an interrupt.

View File

@@ -0,0 +1,2 @@
*** TEST INTERRUPT CRITICAL SECTION 17 ***
*** END OF INTERRUPT CRITICAL SECTION 17 ***