Reading the parallell port quickly?

I have tried various ways, ie using inb() and also /dev/parport0 ioctl calls, but it is way too slow. I can sample an approx 2MHz squarewave on 15.3. I also tried a RT kernel, but it made no difference. Oddly enough does an old 32-bit PC with 11.2 fare much better, or almost 7MHz. Any ideas why.?

Background: I have a need to sample about 64-128k worth of parallell data for later analysis.

Tried this:

    mode = IEEE1284_MODE_ECP;    port = open( "/dev/parport0", O_RDWR );
    ioctl( port, PPCLAIM, NULL );
    ioctl( port, PPNEGOT, &mode );    // You need to pass pointers to integers!
    ioctl( port, PPDATADIR, &dir);


    while (i < MAX_SIZE && more == 1) 
    {
        ioctl( port, PPRDATA   , &c ); // read "data"  Register
        if(temp_data != c)
        {
            data* = c;
            temp_data = c;
            ++i;
        }
    }

and this:

  iopl (3);                     // unlimited I/O access permission, nessesary above the 0x3ff limit e. g. at 0x9800=38912



    setpriority(PRIO_PROCESS, 0, 100);
  
   // Put in handler to let us catch Ctrl-C
   //
   signal(SIGINT, INThandler);    
    




    while (i < MAX_SIZE && more == 1) 
    {
        c = inb (port);          
        if(temp_data != c)
        {
            data* = c;
            temp_data = c;
            ++i;
        }
    }

**

@AndersG:

You’ve enabled ECP – meaning that, you can use DMA – which really means that, you’re heading into device driver internals –

Basically, you’re going to have to get into memory mapping plus, avoiding direct I/O (which is passed through the Kernel) and, allocating DMA buffers – which have to be fixed in memory because, the hardware is going to write to that memory without involving the CPU (and therefore also, the Linux Kernel) …

To use ECP/EPP enable them in BIOS. Tech is too old, so no one cares…