|
From: <jmk...@us...> - 2003-08-13 06:06:01
|
Update of /cvsroot/emc/rtapi/examples/shmem
In directory sc8-pr-cvs1:/tmp/cvs-serv29419/examples/shmem
Modified Files:
Makefile shmemtask.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/shmem/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
***************
*** 50,56 ****
--- 50,62 ----
# DO NOT DELETE
+ /home/John/emcdev/rtapi/lib/shmemtask.o: /home/John/emcdev/rtapi/include/rtapi.h
+ /home/John/emcdev/rtapi/lib/shmemtask.o: /home/John/emcdev/rtapi/include/rtapi_app.h
/home/John/emcdev/rtapi/lib/shmemtask.o: common.h
+ /home/John/emcdev/rtapi/lib/shmemusr.o: /home/John/emcdev/rtapi/include/ulapi.h
/home/John/emcdev/rtapi/lib/shmemusr.o: common.h
+ /home/John/emcdev/rtapi/rtlib/shmemtask.o: /home/John/emcdev/rtapi/include/rtapi.h
+ /home/John/emcdev/rtapi/rtlib/shmemtask.o: /home/John/emcdev/rtapi/include/rtapi_app.h
/home/John/emcdev/rtapi/rtlib/shmemtask.o: common.h
+ /home/John/emcdev/rtapi/rtlib/shmemusr.o: /home/John/emcdev/rtapi/include/ulapi.h
/home/John/emcdev/rtapi/rtlib/shmemusr.o: common.h
Index: shmemtask.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/shmem/shmemtask.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** shmemtask.c 11 Aug 2003 04:58:39 -0000 1.7
--- shmemtask.c 13 Aug 2003 05:55:07 -0000 1.8
***************
*** 9,13 ****
#include "common.h" /* shmem structure, SHMEM_KEY */
! static rtapi_task_handle shmem_task; /* the task */
static rtapi_shmem_handle shmem_mem; /* the shared memory area */
enum { SHMEM_PERIOD_NSEC = 1000000 }; /* timer period, in nanoseconds */
--- 9,13 ----
#include "common.h" /* shmem structure, SHMEM_KEY */
! static int shmem_task; /* the task ID*/
static rtapi_shmem_handle shmem_mem; /* the shared memory area */
enum { SHMEM_PERIOD_NSEC = 1000000 }; /* timer period, in nanoseconds */
***************
*** 17,21 ****
static SHMEM_STRUCT *shmem_struct = 0;
! /* task code, executed each timer interrupt */
void shmem_code ( int arg )
{
--- 17,21 ----
static SHMEM_STRUCT *shmem_struct = 0;
! /* task code, executed periodically */
void shmem_code ( int arg )
{
***************
*** 65,80 ****
/* create the shmem task */
! retval = rtapi_task_new( &shmem_task );
! if ( retval != RTAPI_SUCCESS ) {
! rtapi_print( "shmemtask init: rtapi_task_new returned %d\n", retval );
return -1;
}
/* start the shmem task */
! retval = rtapi_task_start( shmem_task, shmem_code,
! 0, shmem_prio,
! SHMEM_STACKSIZE,
! SHMEM_PERIOD_NSEC, RTAPI_NOW,
! RTAPI_NO_FP );
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("shmemtask init: rtapi_task_start returned %d\n", retval );
--- 65,77 ----
/* create the shmem task */
! shmem_task = rtapi_task_new(shmem_code, 0 /* arg */, shmem_prio,
! SHMEM_STACKSIZE, RTAPI_NO_FP );
! if ( shmem_task < 0 ) {
! rtapi_print( "shmemtask init: rtapi_task_new returned %d\n", shmem_task );
return -1;
}
/* start the shmem task */
! retval = rtapi_task_start( shmem_task, SHMEM_PERIOD_NSEC, RTAPI_NOW );
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("shmemtask init: rtapi_task_start returned %d\n", retval );
***************
*** 96,100 ****
}
! retval = rtapi_task_stop( shmem_task );
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("shmemtask exit: rtapi_task_stop returned %d\n", retval );
--- 93,97 ----
}
! retval = rtapi_task_pause( shmem_task );
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("shmemtask exit: rtapi_task_stop returned %d\n", retval );
***************
*** 106,115 ****
return;
}
! /* TESTING - intentionally skip the shmem_delete
retval = rtapi_shmem_delete( shmem_mem );
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("shmemtask exit: rtapi_shmem_delete returned %d\n", retval );
return;
! }*/
/* Clean up and exit */
rtapi_exit();
--- 103,112 ----
return;
}
! /* TESTING - intentionally skip the shmem_delete */
retval = rtapi_shmem_delete( shmem_mem );
if ( retval != RTAPI_SUCCESS ) {
rtapi_print("shmemtask exit: rtapi_shmem_delete returned %d\n", retval );
return;
! }
/* Clean up and exit */
rtapi_exit();
|