readX/writeX()?are?used?to?access?memory?mapped?devices.?On?some
*?architectures?the?memory?mapped?IO?stuff?needs?to?be?accessed
*?differently.?On?the?simple?architectures,?we?just?read/write?the
*?memory?location?directly.
writel()?往內(nèi)存映射的?I/O?空間上寫(xiě)數(shù)據(jù),wirtel()??I/O?上寫(xiě)入?32?位數(shù)據(jù)?(4字節(jié))。
原型:
#include??
void?writel?(unsigned?char?data?,?unsigned?short?addr?)
readl()?從內(nèi)存映射的?I/O?空間讀取數(shù)據(jù),readl?從?I/O?讀取?32?位數(shù)據(jù)?(?4?字節(jié)?)。
原型:
#include??
unsigned?char?readl?(unsigned?int?addr?)
變量????addr??是?I/O?地址。
返回值?:?從?I/O?空間讀取的數(shù)值。
定義
#define?readb?__raw_readb
#define?readw(addr)?__le16_to_cpu(__raw_readw(addr))
#define?readl(addr)?__le32_to_cpu(__raw_readl(addr))
#ifndef?__raw_readb
static?inline?u8?__raw_readb(const?volatile?void?__iomem?*addr)
{
return?*(const?volatile?u8?__force?*)?addr;
}
#endif
#ifndef?__raw_readw
static?inline?u16?__raw_readw(const?volatile?void?__iomem?*addr)
{
return?*(const?volatile?u16?__force?*)?addr;
}
#endif
#ifndef?__raw_readl
static?inline?u32?__raw_readl(const?volatile?void?__iomem?*addr)
{
return?*(const?volatile?u32?__force?*)?addr;
}
#endif
#define?writeb?__raw_writeb
#define?writew(b,addr)?__raw_writew(__cpu_to_le16(b),addr)
#define?writel(b,addr)?__raw_writel(__cpu_to_le32(b),addr)
?
評(píng)論
查看更多