FW: why MTD model ?
Stephan Linke
Stephan.Linke at epygi.de
Fri Jun 14 05:13:02 EDT 2002
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
>
More information about the linux-mtd
mailing list