RE: need help with Linux IO.h include file



Jon,
I'm not really near a RTLinux machine to see a
multiple module RTLinux driver, but you have to define
the fact that it is a kernel module and that you don't
want to include version information.  I think that defining
it as a kernel module gets rid of the multiply defined macros
but then you need to tell it you don't want version info to
keep other bad things from happening.
Eric


-----Original Message-----
From: emc-at-nist.gov [emc-at-nist.gov]On Behalf Of Jon Elson
Sent: Thursday, June 14, 2001 11:56 PM
To: Multiple recipients of list
Subject: need help with Linux IO.h include file



Hello, all,

I am working on adding didgital I/O to the parallel port cards that I
have working for servo control with EMC.  There is a file,
/usr/src/linux-2.0.36/include/asm-i386/io.h (at least on my system)
which defines 80x86 I/O instructions so they can be placed inline
in the C code.  This makes a HUGE difference in performance, when
the subroutine overhead can be eliminated.

The problem I'm having is that this include file can only be included
in one C source file of a group that are linked together.  If it is
included
in more than on of the source files, you get :

g++ -g  -DLINUX -Dlinux_2_0_36 -DPLATNAME=\"linux_2_0_36\" -D__RT__
-Dlinux -Dlinux_2_0_36 /usr/local/emc/plat/linux_2_0_36/lib/extppmcmot.o
/usr/local/emc/plat/linux_2
_0_36/lib/ppmc_encoder.o /usr/local/emc/plat/linux_2_0_36/lib/ppmc_dac.o
/usr/local/emc/plat/linux_2_0_36/lib/ppmc_aio.o
/usr/local/emc/plat/linux_2_0_36/lib/ppmc_dio.o
 /usr/local/emc/plat/linux_2_0_36/lib/ppmc_internal.o
/usr/local/emc/plat/linux_2_0_36/lib/emcmot.o
/usr/local/emc/plat/linux_2_0_36/lib/emcmotglb.o /usr/local/emc/plat
/linux_2_0_36/lib/trivkins.o /usr/local/emc/plat/linux_2_0_36/lib/pid.o
/usr/local/emc/plat/linux_2_0_36/lib/cubic.o
/usr/local/emc/plat/linux_2_0_36/lib/tp.o /usr/loca
l/emc/plat/linux_2_0_36/lib/tc.o
/usr/local/emc/plat/linux_2_0_36/lib/mmxavg.o
/usr/local/emc/plat/linux_2_0_36/lib/emcmotlog.o
/usr/local/emc/plat/linux_2_0_36/lib/emc
motutil.o \
/usr/local/rcslib/plat/linux_2_0_36/lib/libpm.a \
/usr/local/rcslib/plat/linux_2_0_36/lib/librcs.a \
 -lm \
-o /usr/local/emc/plat/linux_2_0_36/bin/ppmcmot )
/usr/local/emc/plat/linux_2_0_36/lib/ppmc_dio.o: In function
`virt_to_phys':
/usr/include/asm/io.h:47: multiple definition of `virt_to_phys'
/usr/local/emc/plat/linux_2_0_36/lib/ppmc_encoder.o:/usr/include/asm/io.h:47
:
first defined here
/usr/local/emc/plat/linux_2_0_36/lib/ppmc_dio.o: In function
`phys_to_virt':
/usr/include/asm/io.h:52: multiple definition of `phys_to_virt'
/usr/local/emc/plat/linux_2_0_36/lib/ppmc_encoder.o:/usr/include/asm/io.h:52
:
first defined here
/usr/local/emc/plat/linux_2_0_36/lib/ppmc_dio.o: In function `__inb':
/usr/include/asm/io.h:126: multiple definition of `__inb'
/usr/local/emc/plat/linux_2_0_36/lib/ppmc_encoder.o:/usr/include/asm/io.h:12
6:
first defined here
/usr/local/emc/plat/linux_2_0_36/lib/ppmc_dio.o: In function `__inbc':
/usr/include/asm/io.h:126: multiple definition of `__inbc'
/usr/local/emc/plat/linux_2_0_36/lib/ppmc_encoder.o:/usr/include/asm/io.h:12
6:
first defined here
/usr/local/emc/plat/linux_2_0_36/lib/ppmc_dio.o: In function `__inb_p':
/usr/include/asm/io.h:126: multiple definition of `__inb_p'
/usr/local/emc/plat/linux_2_0_36/lib/ppmc_encoder.o:/usr/include/asm/io.h:12
6:
first defined here
/usr/local/emc/plat/linux_2_0_36/lib/ppmc_dio.o: In function `__inbc_p':

/usr/include/asm/io.h:126: multiple definition of `__inbc_p'
/usr/local/emc/plat/linux_2_0_36/lib/ppmc_encoder.o:/usr/include/asm/io.h:12
6:
first defined here
/usr/local/emc/plat/linux_2_0_36/lib/ppmc_dio.o: In function `__inw':

and on and on, ad infinitum!

I can see why virt-to-phys and phys-to-virt are causing a multiple
definition, as these ARE
callable routines.  But, I don't see why this is causing mutliple
definitions of __inb, etc. as these
appear to only be preprocessor defines, and anyway, aren't callable but
inline, so the linker
shouldn't have to know or worry about them.

Does anyone understand this particularly obscure bit of code enough to
help me with this?

Thanks much in advance!

Jon Elson






Date Index | Thread Index | Back to archive index | Back to Mailing List Page

Problems or questions? Contact