Commit 40742dbf authored by julien.delange's avatar julien.delange
Browse files

finalize ni6071e driver



git-svn-id: https://tecsw.estec.esa.int/svn/taste/trunk/po-hi-c@991 129961e7-ef38-4bb5-a8f7-c9a525a55882
parent 67ad4ecc
......@@ -301,6 +301,7 @@ PolyORB-HI-C has been compiled and sucessfully tested on
@item embedded platforms
@itemize @bullet
@item RTLinx, using Elinos
@item Linux embedded, specific version for the TASTE toolset.
@item Nintendo DS (tm) (Linux) - see http://www.dslinux.org
@item Nokia 770 (Linux) - see http://www.maemo.org
@item LEON (SPARC-like CPU) (RTEMS)
......@@ -308,10 +309,19 @@ PolyORB-HI-C has been compiled and sucessfully tested on
@end itemize
@end itemize
When you are using RTEMS operating system, you have to define the @code{RTEMS_MAKEFILE_PATH} environment variable. This variable must point to the directory
that contains the @code{Makefile.inc} file relevant to your platform. In a similar way, when you are using the linux distribution specific to @emph{TASTE}, you have to
set the variable @code{LINUXTASTE_PATH}. This variable should point to the directory where the linux-specific distribution was built. To be sure that
the variable is well defined, you can check that the directory @code{$LINUXTASTE_PATH/output/staging/usr/bin/} exists and that the @code{$LINUXTASTE_PATH/output/staging/usr/bin/i386-linux-gcc}
file exists and is executable (it corresponds to the cross-compiler for this distribution).
@noindent
@emph{Note: PolyORB-HI-C should compile and run on every
POSIX-compliant system.}
@c -------------------------------------------------------------------
@node Tree structure
@section Tree structure
......@@ -630,7 +640,10 @@ Actually, PolyORB-HI-C supports the following devices
@item
@b{NI 6071E} : driver for the National Instrument 6071E card. See
@url{http://sine.ni.com/nips/cds/view/p/lang/en/nid/1042}. The driver was
designed for the EXARM project.
designed for the EXARM project. To be able to use it, you must use
the LINUX TASTE specific distribution that embedds the low-level driver
for the card. For that, the underlying operating system must be
set to x86.linuxtaste.
@end enumerate
......
......@@ -68,53 +68,54 @@ INCLUDE+=-DTARGET=$(TARGET_NAME)
# Files to be compiled
ifeq ($(NEED_TRANSPORT), yes)
PO_HI_OBJS = \
po_hi_task.o \
po_hi_time.o \
po_hi_protected.o \
po_hi_main.o \
po_hi_messages.o \
po_hi_marshallers.o \
po_hi_giop.o \
po_hi_utils.o \
po_hi_types.o \
po_hi_gqueue.o \
drivers/po_hi_driver_exarm.o \
PO_HI_OBJS = \
po_hi_task.o \
po_hi_time.o \
po_hi_protected.o \
po_hi_main.o \
po_hi_messages.o \
po_hi_marshallers.o \
po_hi_giop.o \
po_hi_utils.o \
po_hi_types.o \
po_hi_gqueue.o \
drivers/po_hi_driver_exarm.o \
drivers/po_hi_driver_exarm_ni_6071e_analog.o \
drivers/po_hi_driver_exarm_ni_6071e_digital.o \
drivers/po_hi_driver_linux_serial.o \
drivers/po_hi_driver_sockets.o \
drivers/po_hi_driver_sockets_common.o \
drivers/po_hi_driver_sockets_asn1.o \
drivers/po_hi_driver_rtems_ne2000.o \
drivers/po_hi_driver_rasta_serial.o \
drivers/po_hi_driver_rasta_1553.o \
drivers/po_hi_driver_rasta_1553_brmlib.o \
drivers/po_hi_driver_rasta_spacewire.o \
drivers/po_hi_driver_linux_serial.o \
drivers/po_hi_driver_sockets.o \
drivers/po_hi_driver_sockets_common.o \
drivers/po_hi_driver_sockets_asn1.o \
drivers/po_hi_driver_rtems_ne2000.o \
drivers/po_hi_driver_ni_6071e.o \
drivers/po_hi_driver_rasta_serial.o \
drivers/po_hi_driver_rasta_1553.o \
drivers/po_hi_driver_rasta_1553_brmlib.o \
drivers/po_hi_driver_rasta_spacewire.o \
$(ACTUAL_TRANSPORT) \
po_hi_transport.o $(TARGET_TRANSPORT_SOURCES)
GENERATED_OBJS = \
activity.o \
subprograms.o \
types.o \
request.o \
deployment.o \
marshallers.o \
naming.o \
GENERATED_OBJS = \
activity.o \
subprograms.o \
types.o \
request.o \
deployment.o \
marshallers.o \
naming.o \
main.o
else
PO_HI_OBJS = \
po_hi_task.o \
po_hi_time.o \
po_hi_utils.o \
po_hi_protected.o \
po_hi_main.o
GENERATED_OBJS = \
activity.o \
subprograms.o \
types.o \
PO_HI_OBJS = \
po_hi_task.o \
po_hi_time.o \
po_hi_utils.o \
po_hi_protected.o \
po_hi_main.o
GENERATED_OBJS = \
activity.o \
subprograms.o \
types.o \
main.o
endif
......@@ -162,13 +163,25 @@ ifdef SCADE_DIR
endif
################################################################################
# General RTEMS STUFF
# General RTEMS stuff
check-rtems:
if [ ! -d $$RTEMS_MAKEFILE_PATH/make ]; then \
echo "Please define the RTEMS_MAKEFILE_PATH variable" && exit 2 ; \
fi
################################################################################
# General LINUXTASTE stuff
check-linuxtaste:
if [ ! -d $$LINUXTASTE_PATH/output/staging ]; then \
echo "Please define the LINUXTASTE_PATH variable" ; \
echo "It should point to the directory where the distro was built" && exit 2 ; \
fi
################################################################################
# General compilation rules
......@@ -208,10 +221,10 @@ $(BINARY): generate-asn1-deployment target-objects check-rtems compile-po-hi $(U
ifeq ($(NEED_TRANSPORT), yes)
run: $(BINARY)
pidof qemu >/dev/null 2>&1 ; if [ $$? -eq 0 ]; then \
( sleep 5 ; qemu -net nic,model=ne2k_pci -net socket,connect=127.0.0.1:12345 -fda $(RUNTIME_PATH)/utils/x86-rtems-boot.img -hda fat:. -boot a ; )& \
( sleep 5 ; qemu -net nic,model=ne2k_pci,vlan=1,macaddr=00:1F:C6:BF:74:93 -net socket,connect=127.0.0.1:12345 -fda $(RUNTIME_PATH)/utils/x86-rtems-boot.img -hda fat:. -boot a ; )& \
echo "Launching QEMU in connect mode" ; \
else \
qemu -net nic,model=ne2k_pci -net socket,listen=127.0.0.1:12345 -fda $(RUNTIME_PATH)/utils/x86-rtems-boot.img -hda fat:. -boot a ; \
qemu -net nic,model=ne2k_pci,vlan=1,macaddr=00:1F:C6:BF:74:92 -net socket,listen=:12345 -fda $(RUNTIME_PATH)/utils/x86-rtems-boot.img -hda fat:. -boot a ; \
echo "Launching QEMU in listen mode" ; \
fi
else
......@@ -231,6 +244,12 @@ $(BINARY): generate-asn1-deployment target-objects compile-po-hi $(USER_OBJS) $(
$(CC) -o $(BINARY) $(EXTERNAL_OBJECTS) $(PO_HI_OBJS) $(GENERATED_OBJS) $(USER_OBJS) $(LDFLAGS)
endif
ifeq ($(TARGET), x86.linuxtaste)
$(BINARY): check-linuxtaste generate-asn1-deployment target-objects compile-po-hi $(USER_OBJS) $(GENERATED_OBJS) $(TARGET_OBJECTS)
$(CC) -o $(BINARY) $(EXTERNAL_OBJECTS) $(PO_HI_OBJS) $(GENERATED_OBJS) $(USER_OBJS) $(LDFLAGS)
endif
%.o: %.cpp
$(CPP) $(INCLUDE) $(CPPFLAGS) -c -o $@ $<
......
......@@ -12,12 +12,12 @@ GPROF =
TARGET_SOURCES =
TARGET_TRANSPORT_SOURCES =
TARGET_CFLAGS = -I$(LINUXTASTE_PATH)/output/target/usr/local/include
TARGET_CFLAGS = -I$(LINUXTASTE_PATH)/output/target/usr/local/include -DPOSIX
TARGET_INCLUDE =
LD =
TARGET_LDFLAGS = -L$(LINUXTASTE_PATH)/output/target/usr/local/lib
LD = i386-linux-ld
TARGET_LDFLAGS = -L$(LINUXTASTE_PATH)/output/target/usr/local/lib -lrt -lpthread -lcomedi -lm
target-clean:
target-objects:
......@@ -2,10 +2,68 @@
#ifdef __PO_HI_NEED_DRIVER_EXARM_NI_6071E_ANALOG
#include <comedilib.h>
#include <po_hi_types.h>
comedi_t *po_hi_driver_exarm_ni_6071e_analog_it;
comedi_range* po_hi_driver_exarm_ni_6071e_analog_range_data1;
comedi_range* po_hi_driver_exarm_ni_6071e_analog_range_data2;
comedi_range* po_hi_driver_exarm_ni_6071e_analog_range_data3;
comedi_range* po_hi_driver_exarm_ni_6071e_analog_range_data4;
comedi_range* po_hi_driver_exarm_ni_6071e_analog_range_data5;
comedi_range* po_hi_driver_exarm_ni_6071e_analog_range_data6;
comedi_range* po_hi_driver_exarm_ni_6071e_analog_range_data7;
comedi_range* po_hi_driver_exarm_ni_6071e_analog_range_data8;
comedi_range* po_hi_driver_exarm_ni_6071e_analog_range_data9;
comedi_range* po_hi_driver_exarm_ni_6071e_analog_range_data10;
comedi_range* po_hi_driver_exarm_ni_6071e_analog_range_data11;
comedi_range* po_hi_driver_exarm_ni_6071e_analog_range_data12;
comedi_range* po_hi_driver_exarm_ni_6071e_analog_range_data13;
comedi_range* po_hi_driver_exarm_ni_6071e_analog_range_data14;
comedi_range* po_hi_driver_exarm_ni_6071e_analog_range_data15;
comedi_range* po_hi_driver_exarm_ni_6071e_analog_range_data16;
lsampl_t po_hi_driver_exarm_ni_6071e_analog_data1;
lsampl_t po_hi_driver_exarm_ni_6071e_analog_data2;
lsampl_t po_hi_driver_exarm_ni_6071e_analog_data3;
lsampl_t po_hi_driver_exarm_ni_6071e_analog_data4;
lsampl_t po_hi_driver_exarm_ni_6071e_analog_data5;
lsampl_t po_hi_driver_exarm_ni_6071e_analog_data6;
lsampl_t po_hi_driver_exarm_ni_6071e_analog_data7;
lsampl_t po_hi_driver_exarm_ni_6071e_analog_data8;
lsampl_t po_hi_driver_exarm_ni_6071e_analog_data9;
lsampl_t po_hi_driver_exarm_ni_6071e_analog_data10;
lsampl_t po_hi_driver_exarm_ni_6071e_analog_data11;
lsampl_t po_hi_driver_exarm_ni_6071e_analog_data12;
lsampl_t po_hi_driver_exarm_ni_6071e_analog_data13;
lsampl_t po_hi_driver_exarm_ni_6071e_analog_data14;
lsampl_t po_hi_driver_exarm_ni_6071e_analog_data15;
lsampl_t po_hi_driver_exarm_ni_6071e_analog_data16;
int po_hi_driver_exarm_ni_6071e_analog_channels[16] = {1,2,3,5,6,7,17,18,19,20,22,24,33,34,35,36};
void __po_hi_c_driver_exarm_ni_6071e_analog_init (__po_hi_device_id device_id)
{
po_hi_driver_exarm_ni_6071e_analog_it = comedi_open("/dev/comedi0");
po_hi_driver_exarm_ni_6071e_analog_range_data1 = comedi_get_range (po_hi_driver_exarm_ni_6071e_analog_it,0,po_hi_driver_exarm_ni_6071e_analog_channels[0],0);
po_hi_driver_exarm_ni_6071e_analog_range_data2 = comedi_get_range (po_hi_driver_exarm_ni_6071e_analog_it,0,po_hi_driver_exarm_ni_6071e_analog_channels[1],0);
po_hi_driver_exarm_ni_6071e_analog_range_data3 = comedi_get_range (po_hi_driver_exarm_ni_6071e_analog_it,0,po_hi_driver_exarm_ni_6071e_analog_channels[2],0);
po_hi_driver_exarm_ni_6071e_analog_range_data4 = comedi_get_range (po_hi_driver_exarm_ni_6071e_analog_it,0,po_hi_driver_exarm_ni_6071e_analog_channels[3],0);
po_hi_driver_exarm_ni_6071e_analog_range_data5 = comedi_get_range (po_hi_driver_exarm_ni_6071e_analog_it,0,po_hi_driver_exarm_ni_6071e_analog_channels[4],0);
po_hi_driver_exarm_ni_6071e_analog_range_data6 = comedi_get_range (po_hi_driver_exarm_ni_6071e_analog_it,0,po_hi_driver_exarm_ni_6071e_analog_channels[5],0);
po_hi_driver_exarm_ni_6071e_analog_range_data7 = comedi_get_range (po_hi_driver_exarm_ni_6071e_analog_it,0,po_hi_driver_exarm_ni_6071e_analog_channels[6],0);
po_hi_driver_exarm_ni_6071e_analog_range_data8 = comedi_get_range (po_hi_driver_exarm_ni_6071e_analog_it,0,po_hi_driver_exarm_ni_6071e_analog_channels[7],0);
po_hi_driver_exarm_ni_6071e_analog_range_data9 = comedi_get_range (po_hi_driver_exarm_ni_6071e_analog_it,0,po_hi_driver_exarm_ni_6071e_analog_channels[8],0);
po_hi_driver_exarm_ni_6071e_analog_range_data10 = comedi_get_range (po_hi_driver_exarm_ni_6071e_analog_it,0,po_hi_driver_exarm_ni_6071e_analog_channels[9],0);
po_hi_driver_exarm_ni_6071e_analog_range_data11 = comedi_get_range (po_hi_driver_exarm_ni_6071e_analog_it,0,po_hi_driver_exarm_ni_6071e_analog_channels[10],0);
po_hi_driver_exarm_ni_6071e_analog_range_data12 = comedi_get_range (po_hi_driver_exarm_ni_6071e_analog_it,0,po_hi_driver_exarm_ni_6071e_analog_channels[11],0);
po_hi_driver_exarm_ni_6071e_analog_range_data13 = comedi_get_range (po_hi_driver_exarm_ni_6071e_analog_it,0,po_hi_driver_exarm_ni_6071e_analog_channels[12],0);
po_hi_driver_exarm_ni_6071e_analog_range_data14 = comedi_get_range (po_hi_driver_exarm_ni_6071e_analog_it,0,po_hi_driver_exarm_ni_6071e_analog_channels[13],0);
po_hi_driver_exarm_ni_6071e_analog_range_data15 = comedi_get_range (po_hi_driver_exarm_ni_6071e_analog_it,0,po_hi_driver_exarm_ni_6071e_analog_channels[14],0);
po_hi_driver_exarm_ni_6071e_analog_range_data16 = comedi_get_range (po_hi_driver_exarm_ni_6071e_analog_it,0,po_hi_driver_exarm_ni_6071e_analog_channels[15],0);
return;
}
......@@ -15,7 +73,39 @@ void __po_hi_c_driver_exarm_ni_6071e_analog_poller
double* data9, double* data10, double* data11, double* data12,
double* data13, double* data14, double* data15, double* data16)
{
*data1 = 1;
comedi_data_read (po_hi_driver_exarm_ni_6071e_analog_it,0,po_hi_driver_exarm_ni_6071e_analog_channels[0],0,AREF_GROUND, &po_hi_driver_exarm_ni_6071e_analog_data1);
comedi_data_read (po_hi_driver_exarm_ni_6071e_analog_it,0,po_hi_driver_exarm_ni_6071e_analog_channels[1],0,AREF_GROUND, &po_hi_driver_exarm_ni_6071e_analog_data2);
comedi_data_read (po_hi_driver_exarm_ni_6071e_analog_it,0,po_hi_driver_exarm_ni_6071e_analog_channels[2],0,AREF_GROUND, &po_hi_driver_exarm_ni_6071e_analog_data3);
comedi_data_read (po_hi_driver_exarm_ni_6071e_analog_it,0,po_hi_driver_exarm_ni_6071e_analog_channels[3],0,AREF_GROUND, &po_hi_driver_exarm_ni_6071e_analog_data4);
comedi_data_read (po_hi_driver_exarm_ni_6071e_analog_it,0,po_hi_driver_exarm_ni_6071e_analog_channels[4],0,AREF_GROUND, &po_hi_driver_exarm_ni_6071e_analog_data5);
comedi_data_read (po_hi_driver_exarm_ni_6071e_analog_it,0,po_hi_driver_exarm_ni_6071e_analog_channels[5],0,AREF_GROUND, &po_hi_driver_exarm_ni_6071e_analog_data6);
comedi_data_read (po_hi_driver_exarm_ni_6071e_analog_it,0,po_hi_driver_exarm_ni_6071e_analog_channels[6],0,AREF_GROUND, &po_hi_driver_exarm_ni_6071e_analog_data7);
comedi_data_read (po_hi_driver_exarm_ni_6071e_analog_it,0,po_hi_driver_exarm_ni_6071e_analog_channels[7],0,AREF_GROUND, &po_hi_driver_exarm_ni_6071e_analog_data8);
comedi_data_read (po_hi_driver_exarm_ni_6071e_analog_it,0,po_hi_driver_exarm_ni_6071e_analog_channels[8],0,AREF_GROUND, &po_hi_driver_exarm_ni_6071e_analog_data9);
comedi_data_read (po_hi_driver_exarm_ni_6071e_analog_it,0,po_hi_driver_exarm_ni_6071e_analog_channels[9],0,AREF_GROUND, &po_hi_driver_exarm_ni_6071e_analog_data10);
comedi_data_read (po_hi_driver_exarm_ni_6071e_analog_it,0,po_hi_driver_exarm_ni_6071e_analog_channels[10],0,AREF_GROUND, &po_hi_driver_exarm_ni_6071e_analog_data11);
comedi_data_read (po_hi_driver_exarm_ni_6071e_analog_it,0,po_hi_driver_exarm_ni_6071e_analog_channels[11],0,AREF_GROUND, &po_hi_driver_exarm_ni_6071e_analog_data12);
comedi_data_read (po_hi_driver_exarm_ni_6071e_analog_it,0,po_hi_driver_exarm_ni_6071e_analog_channels[12],0,AREF_GROUND, &po_hi_driver_exarm_ni_6071e_analog_data13);
comedi_data_read (po_hi_driver_exarm_ni_6071e_analog_it,0,po_hi_driver_exarm_ni_6071e_analog_channels[13],0,AREF_GROUND, &po_hi_driver_exarm_ni_6071e_analog_data14);
comedi_data_read (po_hi_driver_exarm_ni_6071e_analog_it,0,po_hi_driver_exarm_ni_6071e_analog_channels[14],0,AREF_GROUND, &po_hi_driver_exarm_ni_6071e_analog_data15);
comedi_data_read (po_hi_driver_exarm_ni_6071e_analog_it,0,po_hi_driver_exarm_ni_6071e_analog_channels[15],0,AREF_GROUND, &po_hi_driver_exarm_ni_6071e_analog_data16);
*data1 = comedi_to_phys (po_hi_driver_exarm_ni_6071e_analog_data1, po_hi_driver_exarm_ni_6071e_analog_range_data1, 4095);
*data2 = comedi_to_phys (po_hi_driver_exarm_ni_6071e_analog_data2, po_hi_driver_exarm_ni_6071e_analog_range_data2, 4095);
*data3 = comedi_to_phys (po_hi_driver_exarm_ni_6071e_analog_data3, po_hi_driver_exarm_ni_6071e_analog_range_data3, 4095);
*data4 = comedi_to_phys (po_hi_driver_exarm_ni_6071e_analog_data4, po_hi_driver_exarm_ni_6071e_analog_range_data4, 4095);
*data5 = comedi_to_phys (po_hi_driver_exarm_ni_6071e_analog_data5, po_hi_driver_exarm_ni_6071e_analog_range_data5, 4095);
*data6 = comedi_to_phys (po_hi_driver_exarm_ni_6071e_analog_data6, po_hi_driver_exarm_ni_6071e_analog_range_data6, 4095);
*data7 = comedi_to_phys (po_hi_driver_exarm_ni_6071e_analog_data7, po_hi_driver_exarm_ni_6071e_analog_range_data7, 4095);
*data8 = comedi_to_phys (po_hi_driver_exarm_ni_6071e_analog_data8, po_hi_driver_exarm_ni_6071e_analog_range_data8, 4095);
*data9 = comedi_to_phys (po_hi_driver_exarm_ni_6071e_analog_data9, po_hi_driver_exarm_ni_6071e_analog_range_data9, 4095);
*data10 = comedi_to_phys (po_hi_driver_exarm_ni_6071e_analog_data10, po_hi_driver_exarm_ni_6071e_analog_range_data10, 4095);
*data11 = comedi_to_phys (po_hi_driver_exarm_ni_6071e_analog_data11, po_hi_driver_exarm_ni_6071e_analog_range_data11, 4095);
*data12 = comedi_to_phys (po_hi_driver_exarm_ni_6071e_analog_data12, po_hi_driver_exarm_ni_6071e_analog_range_data12, 4095);
*data13 = comedi_to_phys (po_hi_driver_exarm_ni_6071e_analog_data13, po_hi_driver_exarm_ni_6071e_analog_range_data13, 4095);
*data14 = comedi_to_phys (po_hi_driver_exarm_ni_6071e_analog_data14, po_hi_driver_exarm_ni_6071e_analog_range_data14, 4095);
*data15 = comedi_to_phys (po_hi_driver_exarm_ni_6071e_analog_data15, po_hi_driver_exarm_ni_6071e_analog_range_data15, 4095);
*data16 = comedi_to_phys (po_hi_driver_exarm_ni_6071e_analog_data16, po_hi_driver_exarm_ni_6071e_analog_range_data16, 4095);
return;
}
......
......@@ -2,18 +2,41 @@
#ifdef __PO_HI_NEED_DRIVER_EXARM_NI_6071E_DIGITAL
#include <comedilib.h>
#include <po_hi_types.h>
#include <po_hi_debug.h>
comedi_t *po_hi_driver_exarm_ni_6071e_digital_it;
void __po_hi_c_driver_exarm_ni_6071e_digital_init (__po_hi_device_id device_id)
{
int ret;
po_hi_driver_exarm_ni_6071e_digital_it = comedi_open("/dev/comedi0");
ret = comedi_dio_config(po_hi_driver_exarm_ni_6071e_digital_it, 2, 1, COMEDI_INPUT);
if (ret == -1)
{
__DEBUGMSG ("Error when invoking comedi_dio_config()");
}
ret = comedi_dio_config(po_hi_driver_exarm_ni_6071e_digital_it, 2, 0, COMEDI_INPUT);
if (ret == -1)
{
__DEBUGMSG ("Error when invoking comedi_dio_config()");
}
return;
}
void __po_hi_c_driver_exarm_ni_6071e_digital_poller (__po_hi_uint8_t* data1, __po_hi_uint8_t* data2)
{
*data1 = 3;
*data2 = 4;
comedi_dio_read(po_hi_driver_exarm_ni_6071e_digital_it, 2, 1, (unsigned int*)data1);
comedi_dio_read(po_hi_driver_exarm_ni_6071e_digital_it, 2, 0, (unsigned int*)data2);
return;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment