乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      readb(), readw(), readl(),

       XeonGate 2015-09-15

      http://blog.csdn.net/hudaweikevin/article/details/18562757

      writel() 往內(nèi)存映射的 I/O 空間上寫數(shù)據(jù),

      wirtel()   I/O 上寫入 32 位數(shù)據(jù) (4字節(jié))。

      原型:引用#include <asm/io.h> 

      void writel (unsigned char data , unsigned short addr )


      readl() 從內(nèi)存映射的 I/O 空間讀取數(shù)據(jù),

      readl 從 I/O 讀取 32 位數(shù)據(jù) ( 4 字節(jié) )。

      原型:#include <asm/io.h> 

      unsigned char readl (unsigned int addr )

      注:變量    addr  是 I/O 地址。

      返回值 : 從 I/O 空間讀取的數(shù)值。


      readb(), readw(), readl() 宏函數(shù)

      功能
      從內(nèi)存映射的 I/O 空間讀取數(shù)據(jù)。

      readb  從 I/O 讀取 8 位數(shù)據(jù) ( 1 字節(jié) );

      readw 從 I/O 讀取 16 位數(shù)據(jù) ( 2 字節(jié) );

      readl 從 I/O 讀取 32 位數(shù)據(jù) ( 4 字節(jié) )。

      原型
      #include <asm/io.h>

      unsigned char readb (unsigned int addr )
      unsigned char readw (unsigned int addr )
      unsigned char readl (unsigned int addr )
             
      變量

      addr    I/O 地址。


      返回值: 從 I/O 空間讀取的數(shù)值。


      __raw_readl和__raw_writel

      Linux對I/O的操作都定義在asm/io.h中,相應(yīng)的在arm平臺下,就在asm-arm/io.h中。

      #define __raw_readl(a)   (__chk_io_ptr(a), *(volatile unsigned int __force   *)(a))
      #define __raw_writel(v,a) (__chk_io_ptr(a), *(volatile unsigned int __force   *)(a) = (v))

      在include\linux\compiler.h中:

      #ifdef __CHECKER__
      ……
      extern void __chk_io_ptr(void __iomem *);
      #else
      ……
      # define __chk_io_ptr(x) (void)0
      ……
      #endif

      __raw_readl(a)展開是:((void)0, *(volatile unsigned int _force *)(a))。在定義了__CHECKER__的時候先調(diào)用__chk_io_ptr檢查該地址,否則__chk_io_ptr什么也不做,*(volatile unsigned int _force *)(a)就是返回地址為a處的值。(void)xx的做法有時候是有用的,例如編譯器打開了檢查未使用的參數(shù)的時候需要將沒有用到的參數(shù)這么弄一下才能編譯通過。

      CPU對I/O的物理地址的編程方式有兩種:一種是I/O映射,一種是內(nèi)存映射。__raw_readl和__raw_writel等是原始的操作I/O的方法,由此派生出來的操作方法有:inb、outb、_memcpy_fromio、readb、writeb、ioread8、iowrite8等。

        本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點(diǎn)擊一鍵舉報。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多