|
From: <jmk...@us...> - 2003-08-20 07:08:17
|
Update of /cvsroot/emc/rtapi/examples/timertask
In directory sc8-pr-cvs1:/tmp/cvs-serv10049/examples/timertask
Modified Files:
timertask.c
Log Message:
moved proc stuff from rtapi_common.h to rtapi_proc.h, put most rtapi internal data in shared memory and put corresponding decls in rtapi_common.h
Index: timertask.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/timertask/timertask.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** timertask.c 15 Aug 2003 20:45:13 -0000 1.12
--- timertask.c 20 Aug 2003 03:16:21 -0000 1.13
***************
*** 36,39 ****
--- 36,40 ----
int retval;
int timer_prio;
+ long period;
if (rtapi_init() != RTAPI_SUCCESS ) {
***************
*** 41,51 ****
}
! /* set the base timer period */
! retval = rtapi_clock_set_period(TIMER_PERIOD_NSEC);
! if ( retval < 0 ) {
! /* See rtapi.h for the error codes returned */
! rtapi_print( "timertask init: rtapi_clock_set_period returned %d\n", retval );
return -1;
}
/* set the task priority to second lowest, since we only have one task */
--- 42,65 ----
}
! /* is timer started? if so, what period? */
! period = rtapi_clock_set_period(0);
! if ( period == 0 ) {
! /* not running, start it */
! rtapi_print("timertask init: starting timer with period %ld\n", TIMER_PERIOD_NSEC);
! period = rtapi_clock_set_period(TIMER_PERIOD_NSEC);
! if (period < 0) {
! rtapi_print("timertask init: rtapi_clock_set_period failed with %ld\n",
! period);
! return -1;
! }
! }
! /* make sure period <= desired period (allow 1% roundoff error) */
! if ( period > (TIMER_PERIOD_NSEC+(TIMER_PERIOD_NSEC/100))) {
! /* timer period too long */
! rtapi_print("timertask init: clock period too long: %ld\n", period );
return -1;
}
+ rtapi_print("timertask init: desired clock %ld, actual %ld\n",
+ TIMER_PERIOD_NSEC, period );
/* set the task priority to second lowest, since we only have one task */
|