* FW: why MTD model ?
@ 2002-06-14 9:13 Stephan Linke
0 siblings, 0 replies; only message in thread
From: Stephan Linke @ 2002-06-14 9:13 UTC (permalink / raw)
To: Linux-Mtd
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
>
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-06-14 9:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-06-14 9:13 FW: why MTD model ? Stephan Linke
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox