您的位置:首页 > 运维架构 > Linux

uClinux2.6(bf561)的NorFlash驱动实现分析(4) : maps定义

2008-02-21 18:35 429 查看

maps用于定义norflash芯片的具体参数及其读写回调函数。在driver/mtd/maps/ezkit561.c中实现了一个CFI Flash的示例,因为AM29lv320支持CFI接口,所以就直接在此文件的基础上修改。
下面就是map_info这个结构体的定义(include/linux/mtd/map.h):
struct map_info {
char *name;
unsigned long size;
unsigned long phys;
#define NO_XIP (-1UL)

void __iomem *virt;
void *cached;

int bankwidth; /* in octets. This isn't necessarily the width
of actual bus cycles -- it's the repeat interval
in bytes, before you are talking to the first chip again.
*/

#ifdef CONFIG_MTD_COMPLEX_MAPPINGS
map_word (*read)(struct map_info *, unsigned long);
void (*copy_from)(struct map_info *, void *, unsigned long, ssize_t);

void (*write)(struct map_info *, const map_word, unsigned long);
void (*copy_to)(struct map_info *, unsigned long, const void *, ssize_t);

/* We can perhaps put in 'point' and 'unpoint' methods, if we really
want to enable XIP for non-linear mappings. Not yet though. */
#endif
/* It's possible for the map driver to use cached memory in its
copy_from implementation (and _only_ with copy_from). However,
when the chip driver knows some flash area has changed contents,
it will signal it to the map driver through this routine to let
the map driver invalidate the corresponding cache as needed.
If there is no cache to care about this can be set to NULL. */
void (*inval_cache)(struct map_info *, unsigned long, ssize_t);

/* set_vpp() must handle being reentered -- enable, enable, disable
must leave it enabled. */
void (*set_vpp)(struct map_info *, int);

unsigned long map_priv_1;
unsigned long map_priv_2;
void *fldrv_priv;
struct mtd_chip_driver *fldrv;
};
在ezkit561.c中将之填充为:
struct map_info ezkit561_map = {
.name = "BF561 EZKIT Map",
.phys = EZKIT561_FLASH_BASE,
.size = EZKIT561_FLASH_SIZE,
.bankwidth = 2, /* 16 bit */
};
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: