From: Denis Oliver Kropp <dok@directfb.org>
To: kaka <share.kt@gmail.com>
Cc: linux-mips@linux-mips.org, uclinux-dev@uclinux.org,
celinux-dev@tree.celinuxforum.org,
linux-fbdev-users@lists.sourceforge.net,
directfb-users@directfb.org, directfb-dev@directfb.org
Subject: Re: Usage of mmap command
Date: Tue, 20 Nov 2007 11:42:45 +0100 [thread overview]
Message-ID: <4742BA25.9070208@directfb.org> (raw)
In-Reply-To: <eea8a9c90711200140w46bda8cek6ee1a1817db9ae0d@mail.gmail.com>
kaka wrote:
> Hi Denis,
>
> Thanks for the reply.
> I am writing gfxdriver for directFB library for broadcom chip.
> I have also written a frambuffer driver for broadcom chip.
Directly for broadcom or at another company?
> In directFB code,
>
> static volatile void *
> system_map_mmio( unsigned int offset,
> int length )
> {
> void *addr;
>
> if (length <= 0)
> length = dfb_fbdev->shared->fix.mmio_len;
>
> addr = mmap( NULL, length, PROT_READ | PROT_WRITE, MAP_SHARED,
> dfb_fbdev->fd, dfb_fbdev->shared->fix.smem_len + offset );
> if ((int)(addr) == -1) {
> D_PERROR( "DirectFB/FBDev: Could not mmap MMIO region "
> "(offset %d, length %d)!\n", offset, length );
> return NULL;
> }
>
> return(volatile void*) ((u8*) addr + (dfb_fbdev->shared->fix.mmio_start&
> dfb_fbdev->shared->page_mask));
> }
Can you add printfs to show dfb_fbdev->shared->fix.mmio_start, mmio_len,
smem_start and smem_len?
> the length and offset i am providing as 0 and -1.
You mean offset 0 and length -1?
> It is throwing me error as Could not mmap MMIO region.
> length coming from dfb_fbdev->shared->fix.smem_len is 16,00,000.
1600000 = 1.6MB?
> When i change the code to addr = mmap( NULL, 900000, PROT_READ |
> PROT_WRITE, MAP_SHARED, dfb_fbdev->fd, dfb_fbdev->shared->fix.smem_len +
> offset );
You changed the length to 900000, but you need to use this to map offset
900000:
addr = mmap( NULL, length, PROT_READ | PROT_WRITE, MAP_SHARED,
dfb_fbdev->fd, 900000 );
But it should work if you set smem_len to 900000 in the fb driver.
> Then it works fine but it is not allowing me to write to addresses with
> offset greater than 900000.
Segfault?
> My requirement is to write in to the MMIO registers with offset between
> 900000 and 16 00 000.
What exactly is your frame buffer size and physical MMIO address?
You need to put the frame buffer size into smem_len and the physical
MMIO address into mmio_start, the length into mmio_len.
--
Best regards,
Denis Oliver Kropp
.------------------------------------------.
| DirectFB - Hardware accelerated graphics |
| http://www.directfb.org/ |
"------------------------------------------"
prev parent reply other threads:[~2007-11-20 10:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-20 6:39 Usage of mmap command kaka
2007-11-20 8:29 ` [directfb-dev] " Denis Oliver Kropp
2007-11-20 9:40 ` kaka
2007-11-20 10:42 ` Denis Oliver Kropp [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=4742BA25.9070208@directfb.org \
--to=dok@directfb.org \
--cc=celinux-dev@tree.celinuxforum.org \
--cc=directfb-dev@directfb.org \
--cc=directfb-users@directfb.org \
--cc=linux-fbdev-users@lists.sourceforge.net \
--cc=linux-mips@linux-mips.org \
--cc=share.kt@gmail.com \
--cc=uclinux-dev@uclinux.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.