mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Richard B. Johnson" <root@chaos.analogic.com>
To: shanthi kiran pendyala <skiranp@cisco.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Mmap problem (VM_DENYWRITE)
Date: Mon, 24 May 2004 16:22:46 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.53.0405241610460.729@chaos> (raw)
In-Reply-To: <000a01c441bf$ccb83600$322147ab@amer.cisco.com>

On Mon, 24 May 2004, shanthi kiran pendyala wrote:

> Hi,
>
> <<I am not subscribed to this list b'cos of the volume of emails. Please
> include my email in the reply.>>

>
> ===================================================================
> My mmap implementation is as follow


Can't you just use ioremap_nocache(FPGA_CSR_ADDR_START, MMAP_SIZE);

>
> #define FPGA_CSR_ADDR_START 0x10940000
> #define FPGA_CSR_ADDR_END   0x1095ffff
> #define MMAP_SIZE (FPGA_CSR_ADDR_END + 1 - FPGA_CSR_ADDR_START)
>

> }
> ================================================================
> I try to access to the device memory region with this user space test
> program
>     ....
> 	fpga_fd = open("/dev/mem", O_RDWR);


If you want to get the physical address from your driver, just
make an ioctl() to return it. In the meantime, mmap() with this
fd.


>
>     if(cde_fd < 0) {
>         printf("can't open %s err %d\n", FPGA_DEV_FILE_NAME, fpga_fd);
>         goto finish;
>     }
>
>     hint = 0x10000000;
>     fpga_csr_start = mmap(hint, MMAP_SIZE,
>                 PROT_READ|PROT_WRITE, MAP_SHARED|MAP_FIXED,
>                 fpga_fd, FPGA_CSR_ADDR_START);
>
>     if (fpga_csr_start == (void *)-1 ) {
                              |_______________ Read docs, don't assume!!

>         printf(" error in mmap errno %d", errno);
>         goto finish;
>     }

      close(fpga_fd);	// Not needed anymore

>
> ...
> ============================================================================
>

Cheers,
Dick Johnson
Penguin : Linux version 2.4.26 on an i686 machine (5570.56 BogoMips).
            Note 96.31% of all statistics are fiction.



  parent reply	other threads:[~2004-05-24 20:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20040519062044.15651.qmail@web90107.mail.scd.yahoo.com>
2004-05-24 18:49 ` shanthi kiran pendyala
2004-05-24 18:58   ` Tommy Reynolds
2004-05-24 20:22   ` Richard B. Johnson [this message]
2004-05-24 20:29   ` Chris Wright

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=Pine.LNX.4.53.0405241610460.729@chaos \
    --to=root@chaos.analogic.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=skiranp@cisco.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®