Skip to contentSkip to conversation

Sensoray 526 analogy driver

PATCH In review Simon Boulay 3 participants 8 messages Dec 26, 2009 – Jan 4, 2010 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Sensoray 526 analogy driver

Hi,

Here is a patch which adds the support of the Sensoray Model 526 board to analogy.
The driver compiles against head but have not been tested on real hardware yet. It has been ported from comedi (staging version) and should work as in comedi:
- Encoder works
- Analog input works
- Analog output works
- PWM output works
- Commands are not supported yet.

Regards,
Simon.

ksrc/drivers/analogy/Config.in +2 -1
index 4bc1197..0336a85 100644
@@ -7,10 +7,11 @@ comment 'ANALOGY drivers'
 
 dep_tristate 'ANALOGY interface' CONFIG_XENO_DRIVERS_ANALOGY $CONFIG_XENO_SKIN_RTDM
 
-if [ "$CONFIG_XENO_DRIVERS_ANALOGY" != "n" ]; then 
+if [ "$CONFIG_XENO_DRIVERS_ANALOGY" != "n" ]; then
    source drivers/xenomai/analogy/testing/Config.in
    source drivers/xenomai/analogy/intel/Config.in
    source drivers/xenomai/analogy/national_instruments/Config.in
+   source drivers/xenomai/analogy/sensoray/Config.in
 fi
 
 endmenu
ksrc/drivers/analogy/Kconfig +1 -0
index 9d17b1d..3769610 100644
@@ -32,5 +32,6 @@ config XENO_DRIVERS_ANALOGY_DEBUG_LEVEL
 source drivers/xenomai/analogy/testing/Kconfig
 source drivers/xenomai/analogy/intel/Kconfig
 source drivers/xenomai/analogy/national_instruments/Kconfig
+source drivers/xenomai/analogy/sensoray/Kconfig
 
 endmenu
ksrc/drivers/analogy/Makefile +2 -1
index c51f5e1..363d625 100644
@@ -4,7 +4,7 @@ ifeq ($(PATCHLEVEL),6)
 
 EXTRA_CFLAGS += -D__IN_XENOMAI__ -Iinclude/xenomai -Idrivers/xenomai/analogy
 
-obj-$(CONFIG_XENO_DRIVERS_ANALOGY) += xeno_analogy.o testing/ intel/ national_instruments/
+obj-$(CONFIG_XENO_DRIVERS_ANALOGY) += xeno_analogy.o testing/ intel/ national_instruments/ sensoray/
 
 xeno_analogy-y := \
 	buffer.o \
@@ -29,6 +29,7 @@ subdir-$(CONFIG_XENO_DRIVERS_ANALOGY_FAKE) += testing
 subdir-$(CONFIG_XENO_DRIVERS_ANALOGY_LOOP) += testing
 subdir-$(CONFIG_XENO_DRIVERS_ANALOGY_8255) += intel
 subdir-$(CONFIG_XENO_DRIVERS_ANALOGY_NI_MITE) += national_instruments
+subdir-$(CONFIG_XENO_DRIVERS_ANALOGY_S526) += sensoray
 
 obj-$(CONFIG_XENO_DRIVERS_ANALOGY) += xeno_analogy.o
 
ksrc/drivers/analogy/sensoray/Config.in new file +2 -0
new file mode 100644
index 0000000..00e956c
@@ -0,0 +1,2 @@
+
+dep_tristate 'Sensoray Model 526 driver' CONFIG_XENO_DRIVERS_ANALOGY_S526 $CONFIG_XENO_DRIVERS_ANALOGY
ksrc/drivers/analogy/sensoray/Kconfig new file +5 -0
new file mode 100644
index 0000000..ce5aa51
@@ -0,0 +1,5 @@
+
+config XENO_DRIVERS_ANALOGY_S526
+	depends on XENO_DRIVERS_ANALOGY
+	tristate "Sensoray Model 526 driver"
+	default n
ksrc/drivers/analogy/sensoray/Makefile new file +30 -0
new file mode 100644
index 0000000..773da98
@@ -0,0 +1,30 @@
+ifeq ($(PATCHLEVEL),6)
+
+# Makefile flag for Linux v2.6
+
+EXTRA_CFLAGS += -D__IN_XENOMAI__ -Iinclude/xenomai
+
+obj-$(CONFIG_XENO_DRIVERS_ANALOGY_S526) += analogy_s526.o
+
+analogy_s526-y := s526.o
+
+else
+
+# Makefile flag for Linux v2.4
+
+O_TARGET := built-in.o
+
+obj-$(CONFIG_XENO_DRIVERS_ANALOGY_S526) += analogy_s526.o
+
+analogy_s526-objs := s526.o
+
+export-objs := $(analogy_s526-objs)
+
+EXTRA_CFLAGS += -D__IN_XENOMAI__ -I$(TOPDIR)/include/xenomai -I$(TOPDIR)/include/xenomai/compat
+
+include $(TOPDIR)/Rules.make
+
+analogy_s526.o: $(analogy_s526-objs)
+	$(LD) -r -o $@ $(analogy_s526-objs)
+
+endif
ksrc/drivers/analogy/sensoray/s526.c new file +975 -0

975 lines not on this page · raw message

#1 lore raw

Hi Simon,

Quoted 4 lines · Simon Boulay

Hi,

Here is a patch which adds the support of the Sensoray Model 526 board to analogy.

Great ! I had a look at the code, that is fine for me. I just have few remarks:
- some "printk" were left commented in the original comedi driver, you correctly translated them into a4l_info; however, could you use a4l_dbg instead and remove the comments ?
- the sources of the original driver contain many areas of commented code and "#if 0 #else #endif" directives. In order to keep coherency with the original driver, I think the import of the driver should be done as it is; nonetheless, the second step would be to clean it inside the git repository.

I think it is wise to wait for the release of 2.5 before integrating it. It will be made available in Xenomai 2.5.1.

Quoted 1 line

The driver compiles against head but have not been tested on real hardware yet.

Alessio was interested by this driver; Alessio, the driver is yours as soon as it is available in my git repository.

Quoted 8 lines

It has been ported from comedi (staging version) and should work as in comedi:
- Encoder works
- Analog input works
- Analog output works
- PWM output works
- Commands are not supported yet.

Regards,

Many thanks for your work !

Quoted 2 lines

Simon.

Alexis.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw
Quoted 6 lines · Alexis Berlemont

Hi Simon,

Quoted 3 lines · Simon Boulay

Hi,

Quoted 8 lines
Quoted 2 lines

Here is a patch which adds the support of the Sensoray Model 526 board to analogy.

Great ! I had a look at the code, that is fine for me. I just have few remarks:
- some "printk" were left commented in the original comedi driver, you correctly translated them into a4l_info; however, could you use a4l_dbg instead and remove the comments ?

Yes.

Quoted 5 lines

- the sources of the original driver contain many areas of commented code and "#if 0 #else #endif" directives. In order to keep coherency with the original driver, I think the import of the driver should be done as it is; nonetheless, the second step would be to clean it inside  the git repository.

I totally agree. The "#if 0 #else #endif" directives are mainly documentation or examples. I don't know if they are useful anymore but I preferred to let them in place for first tests.
I'll send you patches when the driver will be available in your git repository. There are certainly things to add or optimize but I tried to not divert too much from the original driver for the beginning.
If you think that's not the right way of doing, tell me. I plan to publish the jr3 driver port this week. The original code is far more clean but I'll appreciate your advices.

Quoted 2 lines

I think it is wise to wait for the release of 2.5 before integrating it. It will be made available in Xenomai 2.5.1.

ok.

Quoted 5 lines
Quoted 2 lines

The driver compiles against head but have not been tested on real hardware yet.

Alessio was interested by this driver; Alessio, the drivers is yours as soon as it is available in my git repository.

I'll be pleased to help anybody who can test the driver.

Quoted 11 lines
Quoted 9 lines

It has been ported from comedi (staging version) and should work as in comedi:
- Encoder works
- Analog input works
- Analog output works
- PWM output works
- Commands are not supported yet.

Regards,

Many thanks for your work !

Your welcome. Let see if it works...

Quoted 5 lines
Quoted 3 lines

Simon.

Alexis.

#4 lore raw
Quoted 6 lines · Simon Boulay
Quoted 3 lines

Alessio was interested by this driver; Alessio, the drivers is yours as soon as it is available in my git repository.

I'll be pleased to help anybody who can test the driver.

Hi,
good news ... I'll test the patch asap.
Thank you very much for your help.

Alessio

Signature · 14 lines
ISTITUTO ITALIANO
DI TECNOLOGIA

Alessio Margan
/Senior Technician/
mail me <mailto:[email protected]>

Via Morego, 30 16163 Genova <http://maps.google.com/maps?f=q&hl=en&geocode=&q=via+morego,+30+genova&sll=37.0625,-95.677068&sspn=85.420533,191.601563&ie=UTF8&ll=44.474913,8.907037&spn=0.004685,0.011652&t=h&z=17&iwloc=addr>

www.iit.it <http://www.iit.it>

*Legal Disclaimer*
This electronic message contains information that is confidential. The information is intended for the use of the addressee only. If you are not the addressee we would appreciate your notification in this respect. Please note that any disclosure, copy, distribution or use of the contents of this message is prohibited and may be unlawful. We have taken every reasonable precaution to ensure that any kind of attachment to this e-mail has been swept for viruses. However, we cannot accept liability for any damage sustained as a result of software viruses and would advise you to carry out your own virus checks before opening any attachment.     *Avvertenza legale*
Questo messaggio Email contiene informazioni confidenziali riservate ai soli destinatari. Qualora  veniate in possesso di tali informazioni senza essere definito come destinatario vi reghiamo di leggere le seguenti note. Ogni apertura, copia, distribuzione del contenuto del messaggio e dei suoi allegati è proibito e potrebbe violare le presenti leggi. Abbiamo attivato ogni possibile e ragionevole precauzione per assicurare che gli allegati non contengano virus. Comunque non assumeremo alcuna responsabilità per ogni eventuale danno causato da virus software e simili in quanto è onere del destinatario verificarne l’assenza in ogni allegato attuando propri indipendenti controlli.
#5 lore raw

PATCH 1/1 Sensoray 526 analogy driver

Hi,

I start test the sensoray driver.
I've got problem with analogy_config :
1) it seems that board_name as defined have some problem, changed to "a4l_s526" seems better

#define BOARD_NAME "Sensoray Model 526"
...
.board_name = BOARD_NAME
2) I should be able to set as parameters io_port and irq (seems not used), using comedi I do comedi_config /dev/comedi0 s526 0xDC0,0x7 for the moment I set S526_DEFAULT_ADDRESS to my configuration

with this modifications seems to work.

analogy_config -v analogy0 a4l_s526

cat /proc/analogy/drivers
-- Analogy drivers --

| idx | driver name
|  00 | a4l_s526

cat /proc/analogy/devices
-- Analogy devices --

| idx | status | driver
|  00 | Linked | a4l_s526
|  01 | Unused | No driver
|  02 | Unused | No driver
|  03 | Unused | No driver
|  04 | Unused | No driver
|  05 | Unused | No driver
|  06 | Unused | No driver
|  07 | Unused | No driver
|  08 | Unused | No driver
|  09 | Unused | No driver

cat /proc/analogy/00-a4l_s526
-- Subdevices --

| idx | type
|  00 | Counter subdevice
|  01 | Analog input subdevice
|  02 | Analog output subdevice
|  03 | Digital input/output subdevice

Alessio

Signature · 14 lines
ISTITUTO ITALIANO
DI TECNOLOGIA

Alessio Margan
/Senior Technician/
mail me <mailto:[email protected]>

Via Morego, 30 16163 Genova <http://maps.google.com/maps?f=q&hl=en&geocode=&q=via+morego,+30+genova&sll=37.0625,-95.677068&sspn=85.420533,191.601563&ie=UTF8&ll=44.474913,8.907037&spn=0.004685,0.011652&t=h&z=17&iwloc=addr>

www.iit.it <http://www.iit.it>

*Legal Disclaimer*
This electronic message contains information that is confidential. The information is intended for the use of the addressee only. If you are not the addressee we would appreciate your notification in this respect. Please note that any disclosure, copy, distribution or use of the contents of this message is prohibited and may be unlawful. We have taken every reasonable precaution to ensure that any kind of attachment to this e-mail has been swept for viruses. However, we cannot accept liability for any damage sustained as a result of software viruses and would advise you to carry out your own virus checks before opening any attachment.     *Avvertenza legale*
Questo messaggio Email contiene informazioni confidenziali riservate ai soli destinatari. Qualora  veniate in possesso di tali informazioni senza essere definito come destinatario vi reghiamo di leggere le seguenti note. Ogni apertura, copia, distribuzione del contenuto del messaggio e dei suoi allegati è proibito e potrebbe violare le presenti leggi. Abbiamo attivato ogni possibile e ragionevole precauzione per assicurare che gli allegati non contengano virus. Comunque non assumeremo alcuna responsabilità per ogni eventuale danno causato da virus software e simili in quanto è onere del destinatario verificarne l’assenza in ogni allegato attuando propri indipendenti controlli.
#6 lore raw

Hi,

Quoted 3 lines · On 12/30/2009 03:53 PM, Alessio Margan @ IIT wrote:

Hi,

I start test the sensoray driver.

Thank you!

Quoted 7 lines

I've got problem with analogy_config :
1) it seems that board_name as defined have some problem, changed to "a4l_s526" seems better

     #define BOARD_NAME "Sensoray Model 526"
     ...
     .board_name = BOARD_NAME

It works with quotes but it's neither handy nor consistent. It'll be renamed to analogy_s526.

Quoted 4 lines

2) I should be able to set as parameters io_port and irq (seems not used), using comedi I do comedi_config /dev/comedi0 s526 0xDC0,0x7 for the moment I set S526_DEFAULT_ADDRESS to my configuration with this modifications seems to work.

The irq parameter is not used. It's not used in comedi either.
For the io_port, the command analogy_config analogy0 analogy_s526 0xdc0 works for me...

Did you try to acquire data?

Simon.

Quoted 31 lines

analogy_config -v analogy0 a4l_s526

cat /proc/analogy/drivers
-- Analogy drivers --

| idx | driver name
|  00 | a4l_s526

cat /proc/analogy/devices
-- Analogy devices --

| idx | status | driver
|  00 | Linked | a4l_s526
|  01 | Unused | No driver
|  02 | Unused | No driver
|  03 | Unused | No driver
|  04 | Unused | No driver
|  05 | Unused | No driver
|  06 | Unused | No driver
|  07 | Unused | No driver
|  08 | Unused | No driver
|  09 | Unused | No driver

cat /proc/analogy/00-a4l_s526
-- Subdevices --

| idx | type
|  00 | Counter subdevice
|  01 | Analog input subdevice
|  02 | Analog output subdevice
|  03 | Digital input/output subdevice

Alessio

#7 lore raw

Hi,

Quoted 4 lines

The irq parameter is not used. It's not used in comedi either.
For the io_port, the command analogy_config analogy0 analogy_s526 0xdc0 works for me...

not for me ... driver arg 0xdc0 when red by sscanf(opts, "%u", &res[(*nb) - 1]) in analogy_config.c in function compute_opts is set to 0 due to %u
if I use the decimal value of ioport it works ... analogy_config analogy0 analogy_s526 3520

Quoted 2 lines

Did you try to acquire data?

I try with insn_read command find in src/utils/analogy but seems that subdevice should have commands enabled subd->flags |= A4L_SUBD_CMD;

Alessio

Signature · 34 lines
ISTITUTO ITALIANO
DI TECNOLOGIA

Alessio Margan
/Senior Technician/
mail me <mailto:[email protected]>

Via Morego, 30 16163 Genova
<http://maps.google.com/maps?f=q&hl=en&geocode=&q=via+morego,+30+genova&sll=37.0625,-95.677068&sspn=85.420533,191.601563&ie=UTF8&ll=44.474913,8.907037&spn=0.004685,0.011652&t=h&z=17&iwloc=addr>

www.iit.it <http://www.iit.it>

*Legal Disclaimer*
This electronic message contains information that is confidential. The
information is intended for the use of the addressee only. If you are
not the addressee we would appreciate your notification in this respect.
Please note that any disclosure, copy, distribution or use of the
contents of this message is prohibited and may be unlawful. We have
taken every reasonable precaution to ensure that any kind of attachment
to this e-mail has been swept for viruses. However, we cannot accept
liability for any damage sustained as a result of software viruses and
would advise you to carry out your own virus checks before opening any
attachment.
*Avvertenza legale*
Questo messaggio Email contiene informazioni confidenziali riservate ai
soli destinatari. Qualora veniate in possesso di tali informazioni senza
essere definito come destinatario vi reghiamo di leggere le seguenti
note. Ogni apertura, copia, distribuzione del contenuto del messaggio e
dei suoi allegati è proibito e potrebbe violare le presenti leggi.
Abbiamo attivato ogni possibile e ragionevole precauzione per assicurare
che gli allegati non contengano virus. Comunque non assumeremo alcuna
responsabilità per ogni eventuale danno causato da virus software e
simili in quanto è onere del destinatario verificarne l’assenza in ogni
allegato attuando propri indipendenti controlli.
#8 lore raw
Quoted 11 lines · Alessio Margan @ IIT wrote:

Hi,

Quoted 4 lines

The irq parameter is not used. It's not used in comedi either.
For the io_port, the command analogy_config analogy0 analogy_s526 0xdc0 works for me...

not for me ... driver arg 0xdc0 when red by sscanf(opts, "%u", &res[(*nb) - 1]) in analogy_config.c in function compute_opts is set to 0 due to %u
if I use the decimal value of ioport it works ... analogy_config analogy0 analogy_s526 3520

It seems the version you are using is not up to date, this bug was fixed two months ago:

commit 01bcfd898555425e96350b306155cba429a65539
Author: Alexis Berlemont <[email protected]>
Date: Sun Nov 8 02:10:20 2009 +0100

analogy: fix a bug in the attach procedure

The options to be sent to the driver at attach time were badly handled if the values were hexadecimal-based.

Quoted 7 lines
Quoted 2 lines

Did you try to acquire data?

I try with insn_read command find in src/utils/analogy but seems that subdevice should have commands enabled subd->flags |= A4L_SUBD_CMD;

Alessio

Regards,

Alexis.