|
From: <jmk...@us...> - 2003-08-20 07:08:16
|
Update of /cvsroot/emc/rtapi/examples/semaphore
In directory sc8-pr-cvs1:/tmp/cvs-serv10049/examples/semaphore
Modified Files:
master.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: master.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/semaphore/master.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** master.c 14 Aug 2003 04:08:26 -0000 1.10
--- master.c 20 Aug 2003 03:16:20 -0000 1.11
***************
*** 36,39 ****
--- 36,40 ----
int retval;
int master_prio;
+ long period;
if (rtapi_init() != RTAPI_SUCCESS ) {
***************
*** 48,57 ****
}
! /* set the base timer period */
! retval = rtapi_clock_set_period(TIMER_PERIOD_NSEC);
! if ( retval < RTAPI_SUCCESS ) {
! rtapi_print( "sem master init: rtapi_clock_set_period returned %d\n", retval );
return -1;
}
/* set the task priority to one above the lowest; the slave
--- 49,72 ----
}
! /* is timer started? if so, what period? */
! period = rtapi_clock_set_period(0);
! if ( period == 0 ) {
! /* not running, start it */
! rtapi_print("sem master init: starting timer with period %ld\n", TIMER_PERIOD_NSEC);
! period = rtapi_clock_set_period(TIMER_PERIOD_NSEC);
! if (period < 0) {
! rtapi_print("sem master 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("sem master init: clock period too long: %ld\n", period );
return -1;
}
+ rtapi_print("sem master init: desired clock %ld, actual %ld\n",
+ TIMER_PERIOD_NSEC, period );
/* set the task priority to one above the lowest; the slave
|