Linux中readl和writel函数的使用方法

 readX/wri     te      X() 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 loca     ti   on directly.

writel() 往内存映射的 I/O 空间上写数据,wirtel()  I/O 上写入 32 位数据 (4字节)。

 Linux中readl和writel函数的使用方法_设计制作_EDA/IC设计

原型:

#include

void writel (unsigned char data , unsigned short addr )

readl() 从内存映射的 I/O 空间读取数据,readl 从 I/O 读取 32 位数据 ( 4 字节 )。

原型:

#include

unsigned char readl (unsigned int addr )

变量    addr  是 I/O 地址。

返回值 : 从 I/O 空间读取的数值。

定义

#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

sta  TI c inline u8 __raw_readb(const vola  TI le void __iomem *addr)

{

return *(const vola  TI le u8 __force *) addr;

}

#endif

#ifndef __raw_readw

sta  TI c 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)



44
93
0
77

相关资讯

  1. 1、环路面积对电路EMC特性的影响分析184
  2. 2、风起云涌的工业物联网市场,该如何转变商业模式实现自身盈利?1461
  3. 3、Blackfin处理器在图像处理方面的技术优势解析558
  4. 4、中美自动驾驶最新融资情况:千万级和十亿级美元的距离984
  5. 5、PNP与NPN型传感器的各种类型及原理解析239
  6. 6、走进2021:我国机床附件制造水平有待进一步提高1068
  7. 7、常用的电子元器件失效机理与故障分析4780
  8. 8、导致变频器主板故障的原因是什么2420
  9. 9、空调能效新标准将纳入热风机,GMCC核芯压缩机高效应对3890
  10. 10、高端机床制造技术中国与德、日到底差距多少年?2747
全部评论(0)
我也有话说
0
收藏
点赞
顶部