vme_user causes system hang/freeze

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear all,

I've been trying to access the VME-bus using a Xembedded XVME-6300 board 
(with TSI-148 chipset) and the vme_user module from Martyn, with success.
(Thanks to Martyn for an easy demo program).

I've modified the code (see below) to...
- use A_32/D_32
- use 0x8BB00000 as base address
- read data at an offset 0x8400 from this address
- do a read of 6400 bytes instead of 512 bytes
This seems to be working perfect (another VME-card writes a recognizable 
pattern at the above address, and I can see it using the printf-statements).

HOWEVER:
When I do this read in a loop (eg. 100 times), 
then my whole system freezes/hangs after about 50 times,
and I have to power off/power on the machine...

Does anybody have an idea what's going wrong ?
Can I activate something to find out the problem ?

Kind regards,
Steven De Roo

--------------------------------------------------------------------------------

#define _XOPEN_SOURCE 500
#define u32 unsigned int // Needed to add this line
#include <linux/types.h> // Needed to add this line
#include <stdio.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include "vme_user.h"

int main(int argc, char *argv[])
{
        int fd;
        int i;
        int retval;
        unsigned char data[6400];

        struct vme_master master;

        fd = open("/dev/bus/vme/m0", O_RDONLY);
        if (fd == -1) {
                perror("ERROR: Opening window device file");
                return 1;
        }

        master.enable   = 1;
        master.vme_addr = 0x8BB00000; 
        master.size     = 0x10000;
        master.aspace   = 4; // VME_A32
        master.cycle    = 0x2000 | 0x8000; // user/data access
        master.dwidth   = 4; // VME_D32

        retval = ioctl(fd, VME_SET_MASTER, &master);
        if (retval != 0) {
                printf("retval=%d\n", retval);
                perror("ERROR: Failed to configure window");
                return 1;
        }
        for (i=0; i<sizeof(data); i++) {
                data[i] = 0;
        }

        for (loop=0; loop<100; loop++)
        { 
                retval = pread(fd, data, sizeof(data), 0x8400); 
                if (retval < sizeof(data)) {
                        printf("WARNING: Only read %d bytes", retval);
                }
        
        	    // Print first 64 bytes
                for(i=0; i<8*8; i++) {
                        if (i % 8 == 0) {
                                printf("\n""%4.4x: ", i);
                        }
                        printf("%2.2x ", data[i]);
                }
                printf("\n");
        }

        close(fd);

        return 0;
}
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux