|
From: <jmk...@us...> - 2003-08-15 20:47:53
|
Update of /cvsroot/emc/rtapi/examples/fifo
In directory sc8-pr-cvs1:/tmp/cvs-serv2354/examples/fifo
Modified Files:
common.h fifotask.c
Log Message:
Finished converting rtai_rtapi.c, added watchdog example.
Index: common.h
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/fifo/common.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** common.h 10 Aug 2003 22:42:55 -0000 1.2
--- common.h 15 Aug 2003 20:45:13 -0000 1.3
***************
*** 2,6 ****
#define COMMON_H
! enum { FIFO_KEY = 1 };
enum { FIFO_SIZE = 1024 };
--- 2,6 ----
#define COMMON_H
! enum { FIFO_KEY = 14 };
enum { FIFO_SIZE = 1024 };
Index: fifotask.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/fifo/fifotask.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** fifotask.c 13 Aug 2003 05:55:07 -0000 1.14
--- fifotask.c 15 Aug 2003 20:45:13 -0000 1.15
***************
*** 10,14 ****
static int fifo_task; /* the task ID */
! static rtapi_fifo_handle fifo;
enum { TIMER_PERIOD_NSEC = 10000000 }; /* timer period, in nanoseconds */
enum { FIFO_PERIOD_NSEC = 1000000000 }; /* timer period, in nanoseconds */
--- 10,14 ----
static int fifo_task; /* the task ID */
! static int fifo; /* the fifo ID */
enum { TIMER_PERIOD_NSEC = 10000000 }; /* timer period, in nanoseconds */
enum { FIFO_PERIOD_NSEC = 1000000000 }; /* timer period, in nanoseconds */
***************
*** 62,69 ****
}
/* allocate and initialize the fifo */
! retval = rtapi_fifo_new(FIFO_KEY, FIFO_SIZE, &fifo);
! if (retval != RTAPI_SUCCESS) {
! rtapi_print("fifotask init: rtapi_fifo_new failed with %d\n", retval);
goto no_fifo;
}
--- 62,70 ----
}
+ retval = -1;
/* allocate and initialize the fifo */
! fifo = rtapi_fifo_new(FIFO_KEY, FIFO_SIZE, 'W');
! if (fifo < 0 ) {
! rtapi_print("fifotask init: rtapi_fifo_new failed with %d\n", fifo);
goto no_fifo;
}
***************
*** 105,109 ****
rtapi_task_delete(fifo_task);
no_task:
! rtapi_fifo_delete(fifo);
no_fifo:
return retval;
--- 106,110 ----
rtapi_task_delete(fifo_task);
no_task:
! rtapi_fifo_delete(fifo, 'W');
no_fifo:
return retval;
***************
*** 124,132 ****
rtapi_print("fifotask exit: rtapi_task_delete failed with %d\n", retval);
}
! /* TESTING - Intentionally fail to delete fifo
! retval = rtapi_fifo_delete(fifo);
if (retval != RTAPI_SUCCESS) {
rtapi_print("fifotask exit: rtapi_fifo_delete failed with %d\n", retval);
! } */
rtapi_print("fifotask exit: done\n");
--- 125,133 ----
rtapi_print("fifotask exit: rtapi_task_delete failed with %d\n", retval);
}
! /* TESTING - Intentionally fail to delete fifo */
! retval = rtapi_fifo_delete(fifo, 'W');
if (retval != RTAPI_SUCCESS) {
rtapi_print("fifotask exit: rtapi_fifo_delete failed with %d\n", retval);
! }
rtapi_print("fifotask exit: done\n");
|