|
From: <jmk...@us...> - 2003-08-20 08:34:15
|
Update of /cvsroot/emc/rtapi/examples/fifo
In directory sc8-pr-cvs1:/tmp/cvs-serv10049/examples/fifo
Modified Files:
fifotask.c fifousr.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: fifotask.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/fifo/fifotask.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** fifotask.c 15 Aug 2003 20:45:13 -0000 1.15
--- fifotask.c 20 Aug 2003 03:16:20 -0000 1.16
***************
*** 57,60 ****
--- 57,61 ----
int retval;
int fifo_prio;
+ long period;
if (rtapi_init() != RTAPI_SUCCESS ) {
***************
*** 72,82 ****
rtapi_print("fifotask: created fifo\n");
! /* set the base timer period */
! retval = rtapi_clock_set_period(TIMER_PERIOD_NSEC);
! if (retval < 0) {
! rtapi_print("fifotask init: rtapi_clock_set_period failed with %d\n",
! retval);
goto no_task;
}
/* set the task priority to lowest, since we only have one task */
--- 73,96 ----
rtapi_print("fifotask: created fifo\n");
! /* is timer started? if so, what period? */
! period = rtapi_clock_set_period(0);
! if ( period == 0 ) {
! /* not running, start it */
! rtapi_print("fifotask init: starting timer with period %ld\n", TIMER_PERIOD_NSEC);
! period = rtapi_clock_set_period(TIMER_PERIOD_NSEC);
! if (period < 0) {
! rtapi_print("fifotask init: rtapi_clock_set_period failed with %ld\n",
! period);
! goto no_task;
! }
! }
! /* make sure period <= desired period (allow 1% roundoff error) */
! if ( period > (TIMER_PERIOD_NSEC+(TIMER_PERIOD_NSEC/100))) {
! /* timer period too long */
! rtapi_print("fifotask init: clock period too long: %ld\n", period );
goto no_task;
}
+ rtapi_print("fifotask init: desired clock %ld, actual %ld\n",
+ TIMER_PERIOD_NSEC, period );
/* set the task priority to lowest, since we only have one task */
Index: fifousr.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/fifo/fifousr.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** fifousr.c 10 Aug 2003 12:06:05 -0000 1.5
--- fifousr.c 20 Aug 2003 03:16:20 -0000 1.6
***************
*** 19,23 ****
int main()
{
! ulapi_fifo_handle fifo;
char buffer[FIFO_SIZE + 1];
int nchars;
--- 19,23 ----
int main()
{
! int fifo;
char buffer[FIFO_SIZE + 1];
int nchars;
***************
*** 31,37 ****
/* open the fifo */
! retval = ulapi_fifo_new(FIFO_KEY, FIFO_SIZE, 'R', &fifo);
! if (retval != ULAPI_SUCCESS) {
! printf("fifousr main: ulapi_fifo_new returned %d\n", retval);
return -1;
}
--- 31,37 ----
/* open the fifo */
! fifo = ulapi_fifo_new(FIFO_KEY, FIFO_SIZE, 'R');
! if (fifo < 0) {
! printf("fifousr main: ulapi_fifo_new returned %d\n", fifo);
return -1;
}
***************
*** 57,61 ****
printf("shutting down\n");
! retval = ulapi_fifo_delete(fifo);
if (retval != ULAPI_SUCCESS) {
printf("fifousr main: ulapi_fifo_delete returned %d\n", retval);
--- 57,61 ----
printf("shutting down\n");
! retval = ulapi_fifo_delete(fifo, 'R');
if (retval != ULAPI_SUCCESS) {
printf("fifousr main: ulapi_fifo_delete returned %d\n", retval);
|