mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-28 15:53:06 +08:00
2009-10-04 Joel Sherrill <joel.sherrill@oarcorp.com>
* posix/include/rtems/posix/psignal.h: Add extern for ualarm timer. * posix/src/alarm.c, posix/src/ualarm.c: Change from switch to if since many enumerated values have no action. * posix/src/psignal.c: Initialize ualarm and alarm timers.
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
2009-10-04 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||
|
||||
* posix/include/rtems/posix/psignal.h: Add extern for ualarm timer.
|
||||
* posix/src/alarm.c, posix/src/ualarm.c: Change from switch to if since
|
||||
many enumerated values have no action.
|
||||
* posix/src/psignal.c: Initialize ualarm and alarm timers.
|
||||
|
||||
2009-10-02 Ralf Corsépius <ralf.corsepius@rtems.org>
|
||||
|
||||
* libmisc/monitor/mon-driver.c: Fix warning if
|
||||
|
||||
@@ -63,6 +63,8 @@ extern struct sigaction _POSIX_signals_Vectors[ SIG_ARRAY_MAX ];
|
||||
|
||||
extern Watchdog_Control _POSIX_signals_Alarm_timer;
|
||||
|
||||
extern Watchdog_Control _POSIX_signals_Ualarm_timer;
|
||||
|
||||
extern Thread_queue_Control _POSIX_signals_Wait_queue;
|
||||
|
||||
extern Chain_Control _POSIX_signals_Inactive_siginfo;
|
||||
|
||||
+10
-15
@@ -56,23 +56,18 @@ unsigned int alarm(
|
||||
if ( !the_timer->routine ) {
|
||||
_Watchdog_Initialize( the_timer, _POSIX_signals_Alarm_TSR, 0, NULL );
|
||||
} else {
|
||||
switch ( _Watchdog_Remove( the_timer ) ) {
|
||||
case WATCHDOG_INACTIVE:
|
||||
case WATCHDOG_BEING_INSERTED:
|
||||
break;
|
||||
Watchdog_States state;
|
||||
|
||||
case WATCHDOG_ACTIVE:
|
||||
case WATCHDOG_REMOVE_IT:
|
||||
/*
|
||||
* The stop_time and start_time fields are snapshots of ticks since
|
||||
* boot. Since alarm() is dealing in seconds, we must account for
|
||||
* this.
|
||||
*/
|
||||
state = _Watchdog_Remove( the_timer );
|
||||
if ( (state == WATCHDOG_ACTIVE) || (state == WATCHDOG_REMOVE_IT) ) {
|
||||
/*
|
||||
* The stop_time and start_time fields are snapshots of ticks since
|
||||
* boot. Since alarm() is dealing in seconds, we must account for
|
||||
* this.
|
||||
*/
|
||||
|
||||
remaining = the_timer->initial -
|
||||
((the_timer->stop_time - the_timer->start_time) /
|
||||
TOD_TICKS_PER_SECOND);
|
||||
break;
|
||||
remaining = the_timer->initial -
|
||||
((the_timer->stop_time - the_timer->start_time) / TOD_TICKS_PER_SECOND);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -214,4 +214,10 @@ void _POSIX_signals_Manager_Initialization(void)
|
||||
} else {
|
||||
_Chain_Initialize_empty( &_POSIX_signals_Inactive_siginfo );
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize the Alarm Timer
|
||||
*/
|
||||
_Watchdog_Initialize( &_POSIX_signals_Alarm_timer, NULL, 0, NULL );
|
||||
_Watchdog_Initialize( &_POSIX_signals_Ualarm_timer, NULL, 0, NULL );
|
||||
}
|
||||
|
||||
+14
-18
@@ -66,27 +66,23 @@ useconds_t ualarm(
|
||||
if ( !the_timer->routine ) {
|
||||
_Watchdog_Initialize( the_timer, _POSIX_signals_Ualarm_TSR, 0, NULL );
|
||||
} else {
|
||||
switch ( _Watchdog_Remove( the_timer ) ) {
|
||||
case WATCHDOG_INACTIVE:
|
||||
case WATCHDOG_BEING_INSERTED:
|
||||
break;
|
||||
Watchdog_States state;
|
||||
|
||||
case WATCHDOG_ACTIVE:
|
||||
case WATCHDOG_REMOVE_IT:
|
||||
/*
|
||||
* The stop_time and start_time fields are snapshots of ticks since
|
||||
* boot. Since alarm() is dealing in seconds, we must account for
|
||||
* this.
|
||||
*/
|
||||
state = _Watchdog_Remove( the_timer );
|
||||
if ( (state == WATCHDOG_ACTIVE) || (state == WATCHDOG_REMOVE_IT) ) {
|
||||
/*
|
||||
* The stop_time and start_time fields are snapshots of ticks since
|
||||
* boot. Since alarm() is dealing in seconds, we must account for
|
||||
* this.
|
||||
*/
|
||||
|
||||
ticks = the_timer->initial;
|
||||
ticks -= (the_timer->stop_time - the_timer->start_time);
|
||||
/* remaining is now in ticks */
|
||||
ticks = the_timer->initial;
|
||||
ticks -= (the_timer->stop_time - the_timer->start_time);
|
||||
/* remaining is now in ticks */
|
||||
|
||||
_Timespec_From_ticks( ticks, &tp );
|
||||
remaining = tp.tv_sec * TOD_MICROSECONDS_PER_SECOND;
|
||||
remaining += tp.tv_nsec / 1000;
|
||||
break;
|
||||
_Timespec_From_ticks( ticks, &tp );
|
||||
remaining = tp.tv_sec * TOD_MICROSECONDS_PER_SECOND;
|
||||
remaining += tp.tv_nsec / 1000;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user