struct map_desc { unsigned long virtual; /* 映射后的虚拟地址 */ unsigned long pfn; /* 物理地址所在的页帧号 */ unsigned long length; /* 映射长度 */ unsigned int type; /* 映射的设备类型 */ };pfn:利用_phys_to_pfn(物理地址)可以计算出物理地址所在的物理页帧号
static struct map_desc s3c_iodesc[] __initdata = { ... };里面保存的全是这种映射关系,目录下还有个初始化函数如下:
void __init s3c64xx_init_io(struct map_desc *mach_desc, int size) { unsigned long idcode; /* initialise the io descriptors we need for initialisation */ iotable_init(s3c_iodesc, ARRAY_SIZE(s3c_iodesc)); ... }内部调用iotable_init完成映射
unsigned ioread8(void *addr) unsigned ioread16(void *addr) unsigned ioread32(void *addr) unsigned readb(address) unsigned readw(address) unsigned readw(address) unsigned readl(address)
void iowrite8(u8 value, void *addr) void iowrite16(u16 value, void *addr) void iowrite32(u32 value, void *addr) void writeb(unsigned value, address) void writew(unsigned value, address) void writel(unsigned value, address)
原文地址:http://blog.csdn.net/zhuwenfeng215/article/details/45225637