public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: "Stephan Linke" <Stephan.Linke@epygi.de>
To: "Linux-Mtd" <linux-mtd@lists.infradead.org>
Subject: FW: why MTD model ?
Date: Fri, 14 Jun 2002 11:13:02 +0200	[thread overview]
Message-ID: <FCEAKDJJAPHPLJFINDAJAEJPCFAA.Stephan.Linke@epygi.de> (raw)

Hi!

> 
> Can somehow we treat(emulate) memory device as a block
> device and treat memory device like a hard disk ?
>

Maybe I didn't got the point. But if you like to use some (maybe 
battery backuped) memory with a filesystem on it you could setup 
your MTD device just like this:
>>>>

static void* memremap;                                            
              
static struct mtd_info *myrammtd;                                 
              

__u8 my_ram_read8(struct map_info *map, unsigned long ofs)
{
    return *(__u8 *)(memremap  + ofs);
}
...

struct map_info my_ram_map = {
    name: "MY bbram    ",
    size: RAM_WINDOW_SIZE,
    buswidth: 4,
    read8: my_ram_read8,
    read16: my_ram_read16,
    read32: my_ram_read32,
    copy_from: my_ram_copy_from,
    write8: my_ram_write8,
    write16: my_ram_write16,
    write32: my_ram_write32,
    copy_to: my_ram_copy_to
};


...
        myrammtd = do_map_probe("map_ram", &my_ram_map);          
            
        if (myrammtd) {
            memremap = ioremap (RAM_WINDOW_ADDR, RAM_WINDOW_SIZE);
            add_mtd_device (myrammtd);
        } else {
            printk ("mtd/my.o: error installing bbdram device!\n");
        }
        return 0;
...

<<<<
(If someone thinks that this is the wrong way, feel free to send 
comments.) :o)



Stephan Linke
> 

                 reply	other threads:[~2002-06-14  9:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=FCEAKDJJAPHPLJFINDAJAEJPCFAA.Stephan.Linke@epygi.de \
    --to=stephan.linke@epygi.de \
    --cc=linux-mtd@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox