If wanted using a physical memory block
(此區塊本loser稱為 MMIO memory mapping I/O block)
This Block is call MMIO
只要請系統將此"實體位置區塊"映射至你準備好的buffer區塊即可
You only make a request to system , mapping this adders to your buffer.
(就像建立一個Link ,Link指向data )
Just like a file link , a pointer to your data.
當然使用完後記得把Link 釋放和刪除。
Don't forget free them after using.
////-------------------------------------------// // FUNCTION : MMIO_TEST // INPUT : // OUTPUT : // DESCRIPTION: // // #include // size : byte // ioremap(unsigned long phy_addr , unsigned int size) // ioremap_nocache(unsigned long phy_addr , unsigned int size) // iounmap() // release_mem_regin( start , size); //-------------------------------------------// // void MMIO_TEST(){ char *reg; reg = ioremap_nocache(0xFEC00000 , 4 ); if(reg != NULL) { printk("Get mmio ,data = 0x%x\n",*reg); //free iounmap(reg); } }
沒有留言:
張貼留言