|
From: <jmk...@us...> - 2003-08-13 06:06:05
|
Update of /cvsroot/emc/rtapi/examples/timertask
In directory sc8-pr-cvs1:/tmp/cvs-serv29419/examples/timertask
Modified Files:
Makefile timertask.c
Log Message:
major changes to tasks API. Task IDs are now ints, not pointers. More changes on the way. RTAI builds and examples work. RTLinux and sim will be updated once rtai is done.
Index: Makefile
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/timertask/Makefile,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Makefile 10 Aug 2003 21:13:04 -0000 1.4
--- Makefile 13 Aug 2003 05:55:07 -0000 1.5
***************
*** 32,33 ****
--- 32,36 ----
# DO NOT DELETE
+
+ /home/John/emcdev/rtapi/rtlib/timertask.o: /home/John/emcdev/rtapi/include/rtapi.h
+ /home/John/emcdev/rtapi/rtlib/timertask.o: /home/John/emcdev/rtapi/include/rtapi_app.h
Index: timertask.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/timertask/timertask.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** timertask.c 11 Aug 2003 04:58:39 -0000 1.9
--- timertask.c 13 Aug 2003 05:55:07 -0000 1.10
***************
*** 9,14 ****
#include "rtapi_app.h" /* rtapi_app_main,exit() */
! static rtapi_task_handle timer_task; /* the task */
! static int timer_count = 0; /* the output variable */
enum { TIMER_PERIOD_NSEC = 1000000 }; /* timer period, in nanoseconds */
enum { TASK_PERIOD_NSEC = 1000000 }; /* task period, in nanoseconds */
--- 9,14 ----
#include "rtapi_app.h" /* rtapi_app_main,exit() */
! static int timer_task; /* the task ID */
! static int timer_count = 0; /* the output variable */
enum { TIMER_PERIOD_NSEC = 1000000 }; /* timer period, in nanoseconds */
enum { TASK_PERIOD_NSEC = 1000000 }; /* task period, in nanoseconds */
***************
*** 53,73 ****
/* create the timer task */
! /* the address of the pointer needs to be passed rather than it's value */
! retval = rtapi_task_new( &timer_task );
!
! if ( retval != RTAPI_SUCCESS ) {
/* See rtapi.h for the error codes returned */
! rtapi_print( "timertask init: rtapi_task_new returned %d\n", retval );
return -1;
}
!
! /* the third arg is an abitrary int that is passed to the timer task
! on the first iterration */
!
! retval = rtapi_task_start( timer_task, timer_code,
! 0, timer_prio,
! TIMER_STACKSIZE,
! TASK_PERIOD_NSEC, RTAPI_NOW,
! RTAPI_NO_FP );
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("timertask init: rtapi_task_start returned %d\n", retval );
--- 53,67 ----
/* create the timer task */
! /* the second arg is an abitrary int that is passed to the timer task
! on the first iterration */
! timer_task = rtapi_task_new(timer_code, 0 /* arg */, timer_prio,
! TIMER_STACKSIZE, RTAPI_NO_FP );
! if ( timer_task < 0 ) {
/* See rtapi.h for the error codes returned */
! rtapi_print( "timertask init: rtapi_task_new returned %d\n", timer_task );
return -1;
}
! /* start the task running */
! retval = rtapi_task_start( timer_task, TASK_PERIOD_NSEC, RTAPI_NOW );
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("timertask init: rtapi_task_start returned %d\n", retval );
***************
*** 88,94 ****
/* Stop the task */
! retval = rtapi_task_stop(timer_task);
if ( retval != RTAPI_SUCCESS ) {
! rtapi_print("timertask exit: rtapi_task_stop returned %d\n", retval );
return;
}
--- 82,88 ----
/* Stop the task */
! retval = rtapi_task_pause(timer_task);
if ( retval != RTAPI_SUCCESS ) {
! rtapi_print("timertask exit: rtapi_task_pause returned %d\n", retval );
return;
}
***************
*** 96,100 ****
/* TESTING - intentionally skip the task_delete
! retval = rtapi_task_delete( timer_task );
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("timertask exit: rtapi_task_delete returned %d\n", retval );
--- 90,94 ----
/* TESTING - intentionally skip the task_delete
! retval = rtapi_task_delete(timer_task);
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("timertask exit: rtapi_task_delete returned %d\n", retval );
|