forked from Imagelibrary/rtems
2008-12-08 Joel Sherrill <joel.sherrill@oarcorp.com>
* psxtimer01/psxtimer.c, psxtimer02/psxtimer.c: Obtain TOD with clock_gettime() NOT by reaching into the SuperCore.
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
2008-12-08 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||
|
||||
* psxtimer01/psxtimer.c, psxtimer02/psxtimer.c: Obtain TOD with
|
||||
clock_gettime() NOT by reaching into the SuperCore.
|
||||
|
||||
2008-10-01 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||
|
||||
* psx01/psx01.scn: Bump version to 4.9.99.0
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
*
|
||||
* Other POSIX facilities such as timers, condition, .. is also used
|
||||
*
|
||||
* COPYRIGHT (c) 1989-2008.
|
||||
* 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.
|
||||
@@ -135,6 +138,7 @@ void * task_a (void *arg)
|
||||
void * task_b (void *arg)
|
||||
{
|
||||
struct timespec my_period;
|
||||
struct timespec now;
|
||||
int my_sig, received_sig;
|
||||
struct itimerspec timerdata;
|
||||
timer_t timer_id;
|
||||
@@ -162,9 +166,10 @@ void * task_b (void *arg)
|
||||
pthread_sigmask(SIG_BLOCK,&set,NULL);
|
||||
|
||||
/* set the timer in periodic mode */
|
||||
clock_gettime( CLOCK_REALTIME, &now );
|
||||
timerdata.it_interval = my_period;
|
||||
timerdata.it_value = _TOD_Now;
|
||||
_Timespec_Add_to( &timerdata.it_value, &my_period);
|
||||
timerdata.it_value = now;
|
||||
_Timespec_Add_to( &timerdata.it_value, &my_period );
|
||||
if (timer_settime(timer_id,TIMER_ABSTIME,&timerdata,NULL) == -1) {
|
||||
perror ("Error in timer setting\n");
|
||||
pthread_exit ((void *) -1);
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
*
|
||||
* Other POSIX facilities such as timers, condition, .. is also used
|
||||
*
|
||||
* COPYRIGHT (c) 1989-2008.
|
||||
* 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.
|
||||
@@ -32,6 +35,7 @@ void *POSIX_Init (
|
||||
)
|
||||
|
||||
{
|
||||
struct timespec now;
|
||||
struct sigevent event;
|
||||
int status;
|
||||
timer_t timer;
|
||||
@@ -92,7 +96,8 @@ void *POSIX_Init (
|
||||
status = timer_settime( timer, TIMER_ABSTIME, &itimer, NULL );
|
||||
fatal_posix_service_status_errno( status, EINVAL, "bad itimer value #2" );
|
||||
|
||||
itimer.it_value = _TOD_Now;
|
||||
clock_gettime( CLOCK_REALTIME, &now );
|
||||
itimer.it_value = now;
|
||||
itimer.it_value.tv_sec = itimer.it_value.tv_sec - 1;
|
||||
puts( "timer_settime - bad itimer value - previous time - EINVAL" );
|
||||
status = timer_settime( timer, TIMER_ABSTIME, &itimer, NULL );
|
||||
|
||||
Reference in New Issue
Block a user