- From: Askar Ibragimov <askar.ibragimov_at_gmail.com>
- Date: Sun, 26 Aug 2007 20:19:13 +0300
Hello,
I have a general question about implementing CMD interface.
First of all, can I normally use CMD interface on a device that do not
produce interrupts?
My device is Advantech PCI 1751 and it bears three counters. Card
itself counts impulses and I need to read them and pass to program
each second. There are no interrupts coming from the counters. From
the point of view of the COMEDI command, I'd like to perform the
following (one channel example):
cmd->start_src = TRIG_NOW;
cmd->start_arg = 0;
cmd->scan_begin_src = TRIG_TIMER;
cmd->scan_begin_arg = msec_to_nsec(1000);/*ns*/
cmd->convert_src = TRIG_TIMER;
cmd->convert_arg = msec_to_nsec(1); /*ns*/
cmd->scan_end_src = TRIG_COUNT;
cmd->scan_end_arg = 1; /* number of channels */
cmd->stop_src = TRIG_NONE;
cmd->stop_arg = 1;
cmd->chanlist = chanlist; // packed before
cmd->chanlist_len = 1;
What I have to set up in the driver that I'm writing? I have current
problems with the driver as follows:
in the device_attach procedure I declare for my counter subdevice
s->do_cmd=pci1751_do_cmd;
s->do_cmdtest = pci1751_do_cmdtest;
So far, I left procedure empty, it should just issue message to the
system message bus that the routine is called.
Now, trying to execute board_info (from comedilib demo set) I got the
following thing:
[root_at_sgo-klf comedi]# bi
overall info:
version code: 0x000749
driver name: pci1751
board name: pci1751
number of subdevices: 4
subdevice 0:
type: 5 (digital I/O)
flags: 0x00030000
number of channels: 24
max data value: 1
ranges:
all chans: [0,5]
command:
not supported
subdevice 1:
type: 5 (digital I/O)
flags: 0x00030000
number of channels: 24
max data value: 1
ranges:
all chans: [0,5]
command:
not supported
subdevice 2:
type: 6 (counter)
flags: 0x00339000
number of channels: 1
max data value: 65535
ranges:
all chans: [0,1]
command:
Segmentation fault
that follows by the system messages like that:
Aug 26 20:15:28 sgo-klf kernel: BUG: unable to handle kernel NULL
pointer dereference at virtual address 00000000
Aug 26 20:15:28 sgo-klf kernel: printing eip:
Aug 26 20:15:28 sgo-klf kernel: 00000000
Aug 26 20:15:28 sgo-klf kernel: *pde = 00000000
Aug 26 20:15:28 sgo-klf kernel: Oops: 0000 [#6]
Aug 26 20:15:28 sgo-klf kernel: last sysfs file:
/class/comedi/comedi0/comedi0_sub2/dev
Aug 26 20:15:28 sgo-klf kernel: Modules linked in: pci1751(U) i915 drm
nfsd exportfs lockd nfs_acl autofs4 sunrpc nf_conntrack_netbios_ns
ipt_REJECT nf_conntrack_ipv4 xt_state nf_conntrack nfnetlink xt_tcpudp
iptable_filter ip_tables x_tables video sbs i2c_ec dock container
button battery asus_acpi backlight ac ipv6 lp parport_pc parport sg
e100 mii snd_hda_intel serio_raw 8255(U) snd_hda_codec comedi(U)
snd_seq_dummy snd_seq_oss snd_seq_midi_event snd_seq ide_cd
snd_seq_device iTCO_wdt snd_pcm_oss snd_mixer_oss iTCO_vendor_support
cdrom snd_pcm snd_timer i2c_i801 ehci_hcd snd floppy soundcore
i2c_core snd_page_alloc uhci_hcd pcspkr dm_snapshot dm_zero dm_mirror
dm_mod ext3 jbd ata_piix libata sd_mod scsi_mod
Aug 26 20:15:28 sgo-klf kernel: CPU: 0
Aug 26 20:15:28 sgo-klf kernel: EIP: 0060:[<00000000>] Not tainted VLI
Aug 26 20:15:28 sgo-klf kernel: EFLAGS: 00010246 (2.6.20-1.2312.fc5 #1)
Aug 26 20:15:28 sgo-klf kernel: EIP is at 0x0
Aug 26 20:15:28 sgo-klf kernel: eax: df533000 ebx: db23beac ecx:
db23beac edx: ce1a1cf8
Aug 26 20:15:28 sgo-klf kernel: esi: e02267f1 edi: ce1a1cf8 ebp:
df533000 esp: db23be6c
Aug 26 20:15:28 sgo-klf kernel: ds: 007b es: 007b ss: 0068
Aug 26 20:15:28 sgo-klf kernel: Process lt-board_info (pid: 21687,
ti=db23b000 task=c234f7b0 task.ti=db23b000)
Aug 26 20:15:28 sgo-klf kernel: Stack: e0227466 c4467480 fffffff2
00000361 c128ed80 c128ed80 04000000 c128eda0
Aug 26 20:15:28 sgo-klf kernel: c4467480 00000001 00000004
d476c000 00000001 00000000 00000000 00000000
Aug 26 20:15:28 sgo-klf kernel: 00000002 00000000 ffffffff
00000000 ffffffff 00000000 ffffffff 00000000
Aug 26 20:15:29 sgo-klf kernel: Call Trace:
Aug 26 20:15:29 sgo-klf kernel: [<e0227466>] comedi_ioctl+0xc75/0xe06 [comedi]
Aug 26 20:15:29 sgo-klf kernel: [<c0418de8>] __wake_up+0x32/0x43
Aug 26 20:15:29 sgo-klf kernel: [<c051f7fc>] tty_ldisc_deref+0x55/0x64
Aug 26 20:15:29 sgo-klf kernel: [<c05211f9>] tty_write+0x1ba/0x1cb
Aug 26 20:15:29 sgo-klf kernel: [<e02267f1>] comedi_ioctl+0x0/0xe06 [comedi]
Aug 26 20:15:29 sgo-klf kernel: [<c04696f2>] do_ioctl+0x3e/0x4d
Aug 26 20:15:29 sgo-klf kernel: [<c0469900>] vfs_ioctl+0x1ff/0x216
Aug 26 20:15:29 sgo-klf kernel: [<c0469963>] sys_ioctl+0x4c/0x65
Aug 26 20:15:29 sgo-klf kernel: [<c0403dc8>] syscall_call+0x7/0xb
Aug 26 20:15:29 sgo-klf kernel: [<c0600033>] unix_sock_destructor+0xbb/0xd3
Aug 26 20:15:29 sgo-klf kernel: =======================
Aug 26 20:15:29 sgo-klf kernel: Code: Bad EIP value.
Aug 26 20:15:29 sgo-klf kernel: EIP: [<00000000>] 0x0 SS:ESP 0068:db23be6c
Please someone suggest me what would be the necessary things in the
driver that would perform CMD acquisitions without interrupts, using
only time-separated readouts! And how to avoid such a strange
messages.
Cheers, Askar
Received on 2007-08-26Z16:19:13