All of lore.kernel.org
 help / color / mirror / Atom feed
From: Didier Kryn <kryn@in2p3.fr>
To: Didier Kryn <kryn@in2p3.fr>
Cc: Konstantin Boyanov <kkboyanov@gmail.com>, linuxppc-embedded@ozlabs.org
Subject: Re: Reading and writing from/to VME device
Date: Mon, 02 Apr 2007 11:21:16 +0200	[thread overview]
Message-ID: <4610CB0C.4070406@in2p3.fr> (raw)
In-Reply-To: <4610C999.5080405@in2p3.fr>

[-- Attachment #1: Type: text/plain, Size: 488 bytes --]

Didier Kryn a écrit :
>     Konstantin, I reproduced your ioctl() problem with the attached 
> program. The conclusion is that the only valid size and base parameters 
> for A16 are windowSizeL=0x10000 and xlatedAddrL=0. This means the A16 
> space can only be mapped as a whole. What you observed with  
> xlatedAddrL=0x10100000 is that the ioctl(), gently masks the irrelevant 
> high order bits.
>
>     Best regards.
>     Didier
>   
    Oops! I forgot the attachment...

[-- Attachment #2: test148.c --]
[-- Type: text/x-csrc, Size: 1554 bytes --]

#include <linux/stddef.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/mman.h>
#include "vmedrv.h"

#if !defined(offsetof)
/* maybe defined (if <linux/stddef.h> included indirectly) */
# define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
#endif

int main(void)
{
   int vmepd, i;
   char *devname="/dev/vme/vme_out0";
   vmeOutWindowCfg_t a16d16 = {0,1,0,0,0,0x1000000,0,0,0,0,0,0,VME_SSTNONE,
                               VME_A16,VME_D16,VME_SCT,VME_SUPER,VME_DATA,0};
   unsigned size_max=0x10000;
   unsigned base, size;
   unsigned short *vmebus;


   vmepd = open(devname, O_RDWR);
   if(vmepd==-1)
     {
        perror(devname);
        return 1;
     }

   for( base=0 ;   (size = size_max - base) ;   base+=0x100 )
     {
        a16d16.xlatedAddrL = base;
        a16d16.windowSizeL = size;
        if(ioctl(vmepd, VME_IOCTL_SET_OUTBOUND, &a16d16))
          printf("ioctl failed for base %x, size %x: %s\n", base, size, strerror(errno));
        else
          printf("ioctl OK for base %x, size %x\n", base, size);
     }

   for( base=0, size=0x100 ;   size <= size_max ;  size+=0x100 )
     {
        a16d16.xlatedAddrL = base;
        a16d16.windowSizeL = size;
        if(ioctl(vmepd, VME_IOCTL_SET_OUTBOUND, &a16d16))
          printf("ioctl failed for base %x, size %x: %s\n", base, size, strerror(errno));
        else
          printf("ioctl OK for base %x, size %x\n", base, size);
     }

  close(vmepd);
}


      reply	other threads:[~2007-04-02  9:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-26 15:14 Reading and writing from/to VME device Konstantin Boyanov
2007-03-26 18:31 ` Martin, Tim
2007-03-27  9:09 ` Didier Kryn
2007-03-27 12:38   ` Didier Kryn
2007-03-27 15:47   ` Konstantin Boyanov
2007-03-27 19:02     ` Martin, Tim
2007-03-28  9:56       ` Didier Kryn
2007-03-29 10:13         ` Konstantin Boyanov
2007-03-29 19:27           ` Martin, Tim
2007-03-30  9:24           ` Didier Kryn
2007-04-02  9:15             ` Didier Kryn
2007-04-02  9:21               ` Didier Kryn [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4610CB0C.4070406@in2p3.fr \
    --to=kryn@in2p3.fr \
    --cc=kkboyanov@gmail.com \
    --cc=linuxppc-embedded@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.