Hi folks, I'm new to RTAI, and I'm confused.

I'm writing a device driver for EMC2, for an FPGA board from Mesa
Electronics called the 7i43.  The 7i43 interfaces to the PC over a
parallel port (EPP).  I'm doing regular old inb() and outb() calls to talk
to the EPP controller on the PC, to ask it to talk to the FPGA for me.
Nothing funny or complicated there.

When I turn on an I/O debugging flag in my driver, it logs, with
rtapi_print_msg(), the values of all bytes it reads & writes.  This shows
up in the kernel logs, with microsecond-resolution timestamps.

The timestamps on the log messages are confusing me...

Sometimes the delay between successive I/O operations is on the order of
3-4 microseconds, which seems reasonable.  Here's a snippet of my syslog,
each line is the debug output corresponding to one inb() or outb()
to the EPP controller, showing what it did.

    [ 4662.613302] selected address 0x01
    [ 4662.613306] read data 0x00
    [ 4662.613309] wrote data 0x00
    [ 4662.613312] read data 0x00
    [ 4662.613315] wrote data 0x01
    [ 4662.613319] read data 0x00
    <100 us delay in my code>
    [ 4662.613423] read data 0x00
    [ 4662.613426] read data 0x00
    [ 4662.613429] selected address 0x00
    [ 4662.613432] read data 0x03
    [ 4662.613436] read data 0x01
    [ 4662.613439] read data 0x07

That part looks fine to me.  So far so good...  Now for the confusing
part:

Sometimes the delay between successive I/O operations is on the order
of 200-300 microseconds!

    [ 5376.475111] selected address 0x01
    [ 5376.475335] read data 0x00
    [ 5376.475552] wrote data 0x00
    [ 5376.475835] read data 0x00
    [ 5376.476072] wrote data 0x01
    [ 5376.476292] read data 0x00
    <100 us delay in my code>
    [ 5376.476610] read data 0x00
    [ 5376.476831] read data 0x00
    [ 5376.477063] selected address 0x00
    [ 5376.477297] read data 0x01       
    [ 5376.477568] read data 0x27
    [ 5376.477841] read data 0x03

I know it's not due to EPP timeouts, because my code checks for that
and because EPP times out after 10 microseconds, not 200 microseconds.


The realtime kernel latency test, run for several minutes under heavy
Linux system load, concludes thusly:

    cd /usr/realtime/testsuite/kern/latency/; ./run
    ...
    RTH|    lat min|    ovl min|    lat avg|    lat max|    ovl max|   overruns
    RTD|      -1590|      -1612|       1527|       9357|      14463|          0


If I run my code over and over, without changing anything about the
system or what it's doing or what I'm doing, the times always fall into
one of those categories, apparently randomly.


My computer:
    
    Dell Dimension 2400

    running Kubuntu 7.10

    running a custom flavor of Ubuntu's 2.6.22
    kernel, following kernel config instructions at
    <http://wiki.linuxcnc.org/cgi-bin/emcinfo.pl?Debian_Lenny_Compile_RTAI>

    running Ubuntu's linux-restricted-modules (for the atheros wifi)

    running the experimental rtai packages from
    <http://linuxcnc.org/experimental/gutsy/>

    /proc/cpuinfo:

        processor       : 0
        vendor_id       : GenuineIntel
        cpu family      : 15
        model           : 2
        model name      : Intel(R) Celeron(R) CPU 2.60GHz
        stepping        : 9
        cpu MHz         : 2591.658
        cache size      : 128 KB
        fdiv_bug        : no
        hlt_bug         : no
        f00f_bug        : no
        coma_bug        : no
        fpu             : yes
        fpu_exception   : yes
        cpuid level     : 2
        wp              : yes
        flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge 
mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe cid xtpr
        bogomips        : 5185.81
        clflush size    : 64

    lspci:

        00:00.0 Host bridge: Intel Corporation 82845G/GL[Brookdale-G]/GE/PE 
DRAM Controller/Host-Hub Interface (rev 01)
        00:02.0 VGA compatible controller: Intel Corporation 
82845G/GL[Brookdale-G]/GE Chipset Integrated Graphics Device (rev 01)
        00:1d.0 USB Controller: Intel Corporation 82801DB/DBL/DBM 
(ICH4/ICH4-L/ICH4-M) USB UHCI Controller #1 (rev 01)
        00:1d.1 USB Controller: Intel Corporation 82801DB/DBL/DBM 
(ICH4/ICH4-L/ICH4-M) USB UHCI Controller #2 (rev 01)
        00:1d.2 USB Controller: Intel Corporation 82801DB/DBL/DBM 
(ICH4/ICH4-L/ICH4-M) USB UHCI Controller #3 (rev 01)
        00:1d.7 USB Controller: Intel Corporation 82801DB/DBM (ICH4/ICH4-M) 
USB2 EHCI Controller (rev 01)
        00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev 81)
        00:1f.0 ISA bridge: Intel Corporation 82801DB/DBL (ICH4/ICH4-L) LPC 
Interface Bridge (rev 01)
        00:1f.1 IDE interface: Intel Corporation 82801DB (ICH4) IDE Controller 
(rev 01)
        00:1f.3 SMBus: Intel Corporation 82801DB/DBL/DBM (ICH4/ICH4-L/ICH4-M) 
SMBus Controller (rev 01)
        01:05.0 Communication controller: NetMos Technology PCI 1 port parallel 
adapter (rev 01)
        01:06.0 Ethernet controller: Atheros Communications, Inc. AR5212/AR5213 
Multiprotocol MAC/baseband processor (rev 01)
        01:09.0 Ethernet controller: Broadcom Corporation BCM4401 100Base-T 
(rev 01)


I'm baffled.  Why is it sometimes slow and sometimes fast?


-- 
Sebastian Kuzminsky

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to