writing a real time task for rtai and comedi

Hi all,

I am using a linux 2.4.18 kernel patched wiht rtai-24.1.10 and a recent 
cvs snapshot of comedi
and comedilib.

I've managed to run the rtai examples, and the comedi examples and I've 
been able to "talk"
with the digital io on my ni6036e daq board.  

The mail list archive makes mention of real time examples packaged with 
comedi.
I hunted around but could not find them, can anyone point me in the 
right direction.

Right now I am gutting one of the rtai examples I have and merging it 
with the comedi dio.c
example.  My goal us just to talk to the digital io on the daq board in 
real time.

When I compile the code I get tons of "previously defined" warning and 
then the make bails.

What can I do to work around this?

My makefile runs the following

kgcc -Wall -O2 -I/usr/src/linux/include -I/usr/src/rtai/include 
-I/usr/src/rtai/newfifos \
            -DRTAI_RTF_NAMED \
            -o us_appl us_appl.c
kgcc -Wall  -O2 -I/usr/src/linux/include -I/usr/src/rtai/include 
-I/usr/src/rtai/newfifos  \
            -DMODULE -D__KERNEL__ -DRTAI_RTF_NAMED \
            -o servotmp.o -c simpleDIO.c

My includes are -

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/version.h>
#include <asm/io.h>

#include <rtai.h>
#include <rtai_sched.h>
#include <rtai_fifos.h>

#define PORT 0x378

RT_TASK task_data;

int position=0;
MODULE_PARM(position,"i");

int fifo=0;

#define TIME1ms   1000000
#define TIME19ms 19000000

#include <stdio.h>
#include <comedilib.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <getopt.h>
#include <ctype.h>


And these are my  warnings

kgcc -Wall -O2 -I/usr/src/linux/include -I/usr/src/rtai/include 
-I/usr/src/rtai/newfifos -I/usr/src/linux -lcomedi \
            -DRTAI_RTF_NAMED \
            -o us_appl us_appl.c 
kgcc -Wall  -O2 -I/usr/src/linux/include -I/usr/src/rtai/include 
-I/usr/src/rtai/newfifos -I/usr/src/linux -lcomedi  \
            -DMODULE -D__KERNEL__ -DRTAI_RTF_NAMED \
            -o servotmp.o -c simpleDIO.c
In file included from /usr/src/rtai/include/asm/rtai.h:5,
                 from /usr/src/rtai/include/rtai.h:11,
                 from simpleDIO.c:12:
/usr/src/rtai/include/asm/allsoft_rtai.h:196: warning: `hard_cli' redefined
/usr/src/linux/include/asm/system.h:321: warning: this is the location 
of the previous definition
/usr/src/rtai/include/asm/allsoft_rtai.h:197: warning: `hard_sti' redefined
/usr/src/linux/include/asm/system.h:322: warning: this is the location 
of the previous definition
/usr/src/rtai/include/asm/allsoft_rtai.h:198: warning: 
`hard_restore_flags' redefined
/usr/src/linux/include/asm/system.h:320: warning: this is the location 
of the previous definition
/usr/src/rtai/include/asm/allsoft_rtai.h:199: warning: `hard_save_flags' 
redefined
/usr/src/linux/include/asm/system.h:319: warning: this is the location 
of the previous definition
/usr/src/rtai/include/asm/allsoft_rtai.h:200: warning: 
`hard_save_flags_and_cli' redefined
/usr/src/linux/include/asm/system.h:323: warning: this is the location 
of the previous definition
In file included from /usr/include/bits/fcntl.h:25,
                 from /usr/include/fcntl.h:33,
                 from /usr/include/comedilib.h:30,
                 from simpleDIO.c:29:
/usr/include/sys/types.h:207: warning: `__BIT_TYPES_DEFINED__' redefined
/usr/src/linux/include/linux/types.h:95: warning: this is the location 
of the previous definition
In file included from /usr/include/sys/select.h:31,
                 from /usr/include/sys/types.h:215,
                 from /usr/include/bits/fcntl.h:25,
                 from /usr/include/fcntl.h:33,
                 from /usr/include/comedilib.h:30,
                 from simpleDIO.c:29:
/usr/include/bits/select.h:35: warning: `__FD_ZERO' redefined
/usr/src/linux/include/asm/posix_types.h:76: warning: this is the 
location of the previous definition
/usr/include/bits/select.h:41: warning: `__FD_SET' redefined
/usr/src/linux/include/asm/posix_types.h:52: warning: this is the 
location of the previous definition
/usr/include/bits/select.h:46: warning: `__FD_CLR' redefined
/usr/src/linux/include/asm/posix_types.h:57: warning: this is the 
location of the previous definition
/usr/include/bits/select.h:55: warning: `__FD_ISSET' redefined
/usr/src/linux/include/asm/posix_types.h:65: warning: this is the 
location of the previous definition
In file included from /usr/include/sys/types.h:215,
                 from /usr/include/bits/fcntl.h:25,
                 from /usr/include/fcntl.h:33,
                 from /usr/include/comedilib.h:30,
                 from simpleDIO.c:29:
/usr/include/sys/select.h:58: warning: `__NFDBITS' redefined
/usr/src/linux/include/linux/posix_types.h:22: warning: this is the 
location of the previous definition
/usr/include/sys/select.h:60: warning: `__FDMASK' redefined
/usr/src/linux/include/linux/posix_types.h:34: warning: this is the 
location of the previous definition
/usr/include/sys/select.h:89: warning: `FD_SET' redefined
/usr/src/linux/include/linux/time.h:106: warning: this is the location 
of the previous definition
/usr/include/sys/select.h:90: warning: `FD_CLR' redefined
/usr/src/linux/include/linux/time.h:107: warning: this is the location 
of the previous definition
/usr/include/sys/select.h:91: warning: `FD_ISSET' redefined
/usr/src/linux/include/linux/time.h:108: warning: this is the location 
of the previous definition
/usr/include/sys/select.h:92: warning: `FD_ZERO' redefined
/usr/src/linux/include/linux/time.h:109: warning: this is the location 
of the previous definition
In file included from /usr/include/sys/types.h:218,
                 from /usr/include/bits/fcntl.h:25,
                 from /usr/include/fcntl.h:33,
                 from /usr/include/comedilib.h:30,
                 from simpleDIO.c:29:
/usr/include/sys/sysmacros.h:28: warning: `major' redefined
/usr/src/linux/include/linux/kdev_t.h:81: warning: this is the location 
of the previous definition
/usr/include/sys/sysmacros.h:29: warning: `minor' redefined
/usr/src/linux/include/linux/kdev_t.h:82: warning: this is the location 
of the previous definition
In file included from /usr/include/fcntl.h:33,
                 from /usr/include/comedilib.h:30,
                 from simpleDIO.c:29:
/usr/include/bits/fcntl.h:166: warning: `FASYNC' redefined
/usr/src/linux/include/asm/fcntl.h:18: warning: this is the location of 
the previous definition
/usr/src/rtai/include/asm/allsoft_rtai.h: In function `rt_spin_lock_irq':
In file included from /usr/src/rtai/include/asm/rtai.h:5,
                 from /usr/src/rtai/include/rtai.h:11,
                 from simpleDIO.c:12:
/usr/src/rtai/include/asm/allsoft_rtai.h:404: warning: implicit 
declaration of function `HARD_CLI'
/usr/src/rtai/include/asm/allsoft_rtai.h: In function `rt_spin_unlock_irq':
/usr/src/rtai/include/asm/allsoft_rtai.h:411: warning: implicit 
declaration of function `HARD_STI'
/usr/src/rtai/include/asm/allsoft_rtai.h: In function 
`rt_spin_lock_irqsave':
/usr/src/rtai/include/asm/allsoft_rtai.h:424: warning: implicit 
declaration of function `HARD_SAVE_FLAGS_AND_CLI'
/usr/src/rtai/include/asm/allsoft_rtai.h: In function 
`rt_spin_unlock_irqrestore':
/usr/src/rtai/include/asm/allsoft_rtai.h:433: warning: implicit 
declaration of function `HARD_RESTORE_FLAGS'
/usr/include/bits/ioctl-types.h: At top level:
In file included from /usr/include/sys/ioctl.h:30,
                 from /usr/include/comedilib.h:29,
                 from simpleDIO.c:29:
/usr/include/bits/ioctl-types.h:29: redefinition of `struct winsize'
/usr/include/bits/ioctl-types.h:38: redefinition of `struct termio'
In file included from /usr/include/bits/fcntl.h:25,
                 from /usr/include/fcntl.h:33,
                 from /usr/include/comedilib.h:30,
                 from simpleDIO.c:29:
/usr/include/sys/types.h:34: warning: redefinition of `u_char'
/usr/src/linux/include/linux/types.h:83: warning: `u_char' previously 
declared here
/usr/include/sys/types.h:35: warning: redefinition of `u_short'
/usr/src/linux/include/linux/types.h:84: warning: `u_short' previously 
declared here
/usr/include/sys/types.h:36: warning: redefinition of `u_int'
/usr/src/linux/include/linux/types.h:85: warning: `u_int' previously 
declared here
/usr/include/sys/types.h:37: warning: redefinition of `u_long'
/usr/src/linux/include/linux/types.h:86: warning: `u_long' previously 
declared here
/usr/include/sys/types.h:39: warning: redefinition of `u_quad_t'
/usr/src/linux/include/linux/coda.h:109: warning: `u_quad_t' previously 
declared here
/usr/include/sys/types.h:40: conflicting types for `fsid_t'
/usr/src/linux/include/asm/statfs.h:8: previous declaration of `fsid_t'
/usr/include/sys/types.h:45: warning: redefinition of `loff_t'
/usr/src/linux/include/linux/types.h:45: warning: `loff_t' previously 
declared here
/usr/include/sys/types.h:49: warning: redefinition of `ino_t'
/usr/src/linux/include/linux/types.h:15: warning: `ino_t' previously 
declared here
/usr/include/sys/types.h:61: conflicting types for `dev_t'
/usr/src/linux/include/linux/types.h:14: previous declaration of `dev_t'
/usr/include/sys/types.h:66: warning: redefinition of `gid_t'
/usr/src/linux/include/linux/types.h:26: warning: `gid_t' previously 
declared here
/usr/include/sys/types.h:71: conflicting types for `mode_t'
/usr/src/linux/include/linux/types.h:16: previous declaration of `mode_t'
/usr/include/sys/types.h:76: conflicting types for `nlink_t'
/usr/src/linux/include/linux/types.h:17: previous declaration of `nlink_t'
/usr/include/sys/types.h:81: warning: redefinition of `uid_t'
/usr/src/linux/include/linux/types.h:25: warning: `uid_t' previously 
declared here
/usr/include/sys/types.h:87: warning: redefinition of `off_t'
/usr/src/linux/include/linux/types.h:18: warning: `off_t' previously 
declared here
/usr/include/sys/types.h:99: warning: redefinition of `pid_t'
/usr/src/linux/include/linux/types.h:19: warning: `pid_t' previously 
declared here
/usr/include/sys/types.h:109: warning: redefinition of `ssize_t'
/usr/src/linux/include/linux/types.h:59: warning: `ssize_t' previously 
declared here
/usr/include/sys/types.h:115: warning: redefinition of `daddr_t'
/usr/src/linux/include/linux/types.h:20: warning: `daddr_t' previously 
declared here
/usr/include/sys/types.h:116: warning: redefinition of `caddr_t'
/usr/src/linux/include/linux/types.h:79: warning: `caddr_t' previously 
declared here
/usr/include/sys/types.h:122: warning: redefinition of `key_t'
/usr/src/linux/include/linux/types.h:21: warning: `key_t' previously 
declared here
In file included from /usr/include/sys/types.h:132,
                 from /usr/include/bits/fcntl.h:25,
                 from /usr/include/fcntl.h:33,
                 from /usr/include/comedilib.h:30,
                 from simpleDIO.c:29:
/usr/include/time.h:70: warning: redefinition of `time_t'
/usr/src/linux/include/linux/types.h:69: warning: `time_t' previously 
declared here
In file included from /usr/include/bits/fcntl.h:25,
                 from /usr/include/fcntl.h:33,
                 from /usr/include/comedilib.h:30,
                 from simpleDIO.c:29:
/usr/include/sys/types.h:150: warning: redefinition of `ulong'
/usr/src/linux/include/linux/types.h:92: warning: `ulong' previously 
declared here
/usr/include/sys/types.h:151: warning: redefinition of `ushort'
/usr/src/linux/include/linux/types.h:90: warning: `ushort' previously 
declared here
/usr/include/sys/types.h:152: warning: redefinition of `uint'
/usr/src/linux/include/linux/types.h:91: warning: `uint' previously 
declared here
/usr/include/sys/types.h:190: warning: redefinition of `int8_t'
/usr/src/linux/include/linux/types.h:98: warning: `int8_t' previously 
declared here
/usr/include/sys/types.h:191: warning: redefinition of `int16_t'
/usr/src/linux/include/linux/types.h:100: warning: `int16_t' previously 
declared here
/usr/include/sys/types.h:192: warning: redefinition of `int32_t'
/usr/src/linux/include/linux/types.h:102: warning: `int32_t' previously 
declared here
/usr/include/sys/types.h:193: warning: redefinition of `int64_t'
/usr/src/linux/include/linux/types.h:113: warning: `int64_t' previously 
declared here
/usr/include/sys/types.h:196: warning: redefinition of `u_int8_t'
/usr/src/linux/include/linux/types.h:97: warning: `u_int8_t' previously 
declared here
/usr/include/sys/types.h:197: warning: redefinition of `u_int16_t'
/usr/src/linux/include/linux/types.h:99: warning: `u_int16_t' previously 
declared here
/usr/include/sys/types.h:198: warning: redefinition of `u_int32_t'
/usr/src/linux/include/linux/types.h:101: warning: `u_int32_t' 
previously declared here
/usr/include/sys/types.h:199: warning: redefinition of `u_int64_t'
/usr/src/linux/include/linux/types.h:112: warning: `u_int64_t' 
previously declared here
In file included from /usr/include/sys/types.h:215,
                 from /usr/include/bits/fcntl.h:25,
                 from /usr/include/fcntl.h:33,
                 from /usr/include/comedilib.h:30,
                 from simpleDIO.c:29:
/usr/include/sys/select.h:38: conflicting types for `sigset_t'
/usr/src/linux/include/asm/signal.h:21: previous declaration of `sigset_t'
In file included from /usr/include/sys/select.h:44,
                 from /usr/include/sys/types.h:215,
                 from /usr/include/bits/fcntl.h:25,
                 from /usr/include/fcntl.h:33,
                 from /usr/include/comedilib.h:30,
                 from simpleDIO.c:29:
/usr/include/time.h:107: redefinition of `struct timespec'
In file included from /usr/include/sys/select.h:46,
                 from /usr/include/sys/types.h:215,
                 from /usr/include/bits/fcntl.h:25,
                 from /usr/include/fcntl.h:33,
                 from /usr/include/comedilib.h:30,
                 from simpleDIO.c:29:
/usr/include/bits/time.h:68: redefinition of `struct timeval'
In file included from /usr/include/sys/types.h:215,
                 from /usr/include/bits/fcntl.h:25,
                 from /usr/include/fcntl.h:33,
                 from /usr/include/comedilib.h:30,
                 from simpleDIO.c:29:
/usr/include/sys/select.h:49: warning: redefinition of `suseconds_t'
/usr/src/linux/include/linux/types.h:22: warning: `suseconds_t' 
previously declared here
/usr/include/sys/select.h:74: conflicting types for `fd_set'
/usr/src/linux/include/linux/types.h:13: previous declaration of `fd_set'
In file included from /usr/include/fcntl.h:33,
                 from /usr/include/comedilib.h:30,
                 from simpleDIO.c:29:
/usr/include/bits/fcntl.h:137: redefinition of `struct flock'
make: *** [simpleDIO.o] Error 1

Received on 2002-11-19Z18:32:59