|
From: <jmk...@us...> - 2003-08-10 21:13:06
|
Update of /cvsroot/emc/rtapi/examples/fifo
In directory sc8-pr-cvs1:/tmp/cvs-serv11923/examples/fifo
Modified Files:
Makefile fifotask.c
Log Message:
misc changes, work in progress
Index: Makefile
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/fifo/Makefile,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Makefile 5 Aug 2003 03:51:00 -0000 1.3
--- Makefile 10 Aug 2003 21:13:03 -0000 1.4
***************
*** 50,62 ****
# DO NOT DELETE
- /home/John/emcdev/rtapi/lib/fifotask.o: /home/John/emcdev/rtapi/include/rtapi.h
- /home/John/emcdev/rtapi/lib/fifotask.o: /home/John/emcdev/rtapi/include/rtapi_app.h
/home/John/emcdev/rtapi/lib/fifotask.o: common.h
- /home/John/emcdev/rtapi/lib/fifousr.o: /home/John/emcdev/rtapi/include/ulapi.h
/home/John/emcdev/rtapi/lib/fifousr.o: common.h
- /home/John/emcdev/rtapi/rtlib/fifotask.o: /home/John/emcdev/rtapi/include/rtapi.h
- /home/John/emcdev/rtapi/rtlib/fifotask.o: /home/John/emcdev/rtapi/include/rtapi_app.h
/home/John/emcdev/rtapi/rtlib/fifotask.o: common.h
- /home/John/emcdev/rtapi/rtlib/fifousr.o: /home/John/emcdev/rtapi/include/ulapi.h
/home/John/emcdev/rtapi/rtlib/fifousr.o: common.h
--- 50,56 ----
Index: fifotask.c
===================================================================
RCS file: /cvsroot/emc/rtapi/examples/fifo/fifotask.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** fifotask.c 9 Aug 2003 19:35:28 -0000 1.9
--- fifotask.c 10 Aug 2003 21:13:03 -0000 1.10
***************
*** 15,36 ****
enum { FIFO_STACKSIZE = 1024 }; /* how big the stack is */
! static int count = 1;
/* task code, executed each timer interrupt */
void fifo_code(int arg)
{
! int n;
char buffer[FIFO_SIZE + 1] = { '\n' };
while (1) {
! for (n = 0; n < count; n++) {
! buffer[n] = '0' + count;
}
! rtapi_fifo_write(fifo, buffer, count);
! buffer[n] = '\0';
! rtapi_print_dbg(4, "fifotask: wrote '%s'\n", buffer);
count++;
! if (count > 9)
! count = 1;
rtapi_wait();
}
--- 15,48 ----
enum { FIFO_STACKSIZE = 1024 }; /* how big the stack is */
! static int count = 0;
! static int len = 0;
! static int total =0;
/* task code, executed each timer interrupt */
void fifo_code(int arg)
{
! int n, tmp;
char buffer[FIFO_SIZE + 1] = { '\n' };
while (1) {
! /* write count to buffer as a 3 digit number */
! tmp = count;
! for ( n = 0 ; n < 3 ; n++ ) {
! buffer[2-n] = '0' + ( tmp % 10 );
! tmp /= 10;
! }
! buffer[3] = ':';
! /* write 'len' digits of 'len' */
! for (n = 0; n < len; n++) {
! buffer[4+n] = '0' + len;
}
! rtapi_fifo_write(fifo, buffer, len+4);
! total += len+4;
! buffer[4+n] = '\0';
! rtapi_print("fifotask: total %d, wrote '%s',\n", total, buffer);
count++;
! len++;
! if (len > 9)
! len = 0;
rtapi_wait();
}
***************
*** 53,59 ****
}
/* set the base timer period */
retval = rtapi_clock_set_period(TIMER_PERIOD_NSEC);
! if (retval != RTAPI_SUCCESS) {
rtapi_print("fifotask init: rtapi_clock_set_period failed with %d\n",
retval);
--- 65,73 ----
}
+ 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);
|