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

Re: bypassing the MMU on the lx chip

Any idea why this attempt doesn't work?
I built the kernel for "support for ram chips in buss mapping"  (mtd

When I try running this program I get "mmap failed: No such device "
I also tried /dev/ram0, /dev/ram1 and /dev/cflash3

#include <unistd.h>
#include <stdio.h>
#include <sys/mman.h>
#include <fcntl.h>

int main() {

unsigned char *virt;

int fd = open("/dev/flash3", O_RDWR);
printf( "fd=%d\n", fd );

virt = mmap( NULL , 128*1024, PROT_READ | PROT_WRITE | PROT_EXEC,
            MAP_SHARED, fd, 0x08000000 );
printf( "%d\n", virt );
if (virt) {
     perror("mmap failed");
     exit( 1 );

Adam Felson
HID Corporation - Engineering
11674 N. Huron Street
Denver, CO 80234-2924
(303) 453-3362

                    Bjorn Wesen                                                              
                    xis.com>              cc:     dev-etrax@xxxxxxx.com                         
                    Sent by:              Subject:     Re: bypassing the MMU on the lx chip  
                    05/15/01 03:59                                                           

On Tue, 15 May 2001, Adam Felson wrote:
> I would want to access it from user mode, running a ramdisk on the 128K
> SRAM would be acceptable.
> I noticed several RAM items in the MTD kernel config such as "support for
> ram chips in bus mapping".
> I turned all of them on to play and now see 'mtd3: 02000000 00010000 "Raw
> memory"' in /proc/mtd.
> Does that correspond to /dev/cflash3?   Is it a usable way to access the

I don't know off-hand what major/minors MTD use or what mtd3 is mapped to,
but yes, you should be able to open and mmap the device node corresponding
to your SRAM and use it from user-mode.

Possibly the device nodes don't exist in the /dev directory per default on
the devboard software - if so you need to figure out the major/minor
numbers and make a node yourself. What you call it is up to you but mtd3
sounds logical doesn't it.

Yes, cflash0 etc. should really be called mtd0, mtd1 etc. I guess, but we
didn't use mtd with our 2.0 port and we wanted to keep the names. It does
not stop aliases existing with the /dev/mtd name structure though