vme_ca91cx42 doesn't touch VMEbus on read with vme_user

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

 



Hello DriverDev,

I recently installed the latest Debian with Kernel 3.16 including all the vme drivers (and vme_user in staging) on a GE VME7807RC.  Using Martyn Welch’s example from 12 March 2013 on this list as a guide, I tried reading out 32 bytes from one of my boards, but I just got a bunch of 0xFF bytes.  

I monitored the bus with a diagnostics board, and didn’t see any activity at all (no addresses, no data) from power-up through booting and trying to read from the bus.  Attempting the same reads with another VME7807 using the GE provided driver lit up the same diagnostics board like a christmas tree (well, the lower 16 bits).

I hope I’m missing something basic, as I don’t see any error messages anywhere to guide my way.

Thanks for your help,
-Jonathan

$ sudo modprobe vme_ca91cx42 
$ sudo modprobe vme_user bus=0
$ dmesg | grep vme
[  632.942457] vme_ca91cx42 0000:01:0d.0: found PCI INT A -> IRQ 14
[  632.942523] vme_ca91cx42 0000:01:0d.0: Board is the VME system controller
[  632.942526] vme_ca91cx42 0000:01:0d.0: Slot ID is 0
[  632.942529] vme_ca91cx42 0000:01:0d.0: CR/CSR Offset: 0
[  632.942533] vme_ca91cx42 0000:01:0d.0: Slot number is unset, not configuring CR/CSR space
[  632.942537] vme_ca91cx42 0000:01:0d.0: CR/CSR configuration failed.
[  640.990642] vme_user: module is from the staging directory, the quality is unknown, you have been warned.
[  640.991404] vme_user: VME User Space Access Driver
$ sudo ./vmetest 
Simple VME User Module Test
WARNING: Only read 32 bytes
0000: ff ff ff ff ff ff ff ff 
0008: ff ff ff ff ff ff ff ff 
0010: ff ff ff ff ff ff ff ff 
0018: ff ff ff ff ff ff ff ff

$ cat main.c
/*
 * main.c
 *
 *  Created on: Jul 29, 2015
 *
 *  Copied from: http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2013-April/037460.html
 *
 */

#define _XOPEN_SOURCE 500
#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[512];

        struct vme_master master;

        printf("Simple VME User Module Test\n");

        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 = 2*0x8000000;
//        master.size = 0x100000;
//        master.aspace = 0x4; // VME_A32
//        master.cycle = 0x2000 | 0x8000; // Unprivileged data access
//        master.dwidth = 0x4; // 32 bit word access
        master.enable = 1;
        master.vme_addr = 0xE000;
        master.size = 0x1000;
        master.aspace = 0x1; // VME_A16
        master.cycle = 0x2000; // Unprivileged data access
        master.dwidth = 0x2; // 16 bit word access

        retval = ioctl(fd, VME_SET_MASTER, &master);
        if (retval != 0) {
                printf("retval=%d\n", retval);
                perror("ERROR: Failed to configure window");
                return 1;
        }

        /*
         * Reading first 32 bytes
         */
        for (i=0; i<32; i++) {
                data[i] = 0;
        }

        retval = pread(fd, data, 32, 0);
        if (retval < 512) {
                printf("WARNING: Only read %d bytes", retval);
        }

        for(i=0; i<retval; i++) {
                if (i % 8 == 0) {
                        printf("\n""%4.4x: ", i);
                }
                printf("%2.2x ", data[i]);
        }
        printf("\n");

        close(fd);

        return 0;
}


----
Jonathan Eisch
Research Associate
Physics & Astronomy
Iowa State University
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-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