Xilinx Xio控制sdr sdram
在嵌入式系統中,sdr sdram控制器對于用戶來講是透明的,即用戶在功能使用上沒有初始化、刷新等操作,直接IO讀寫函數讀寫相應的地址即可。基本的IO讀寫函數在文件io.h中定義,其本質就是簡單的指針賦值語句,32bit位寬的讀寫函數如下所示:
? ? ? ? ? #define XIo_In32(InputPtr)(*(volatile Xunit32*)(InputPtr))
? ? #define XIo_Out32(OutputPtr,Value) (*(volatile Xuint32*)((OutputPtr))=(Value))
因此在操作sdram時,只需添加下列兩個頭文件,其中,xio.h定義了端口操作函數,xparameters.h文件則給出了sdram存儲器的基地址
? ? ? ? #include "xio.h"
? ? ? ? #include "xparameters.h"
/*****************************************************************************/
/**
*
* Performs an input operation for a 32-bit memory location by reading from the
* specified address and returning the value read from that address.
*
* @param InputPtr contains the address to perform the input operation at.
*
* @return The value read from the specified input address.
*
* @note None.
*
******************************************************************************/
#define XIo_In32(InputPtr) ?(*(volatile u32 *)(InputPtr))
/*****************************************************************************/
/**
*
* Performs an output operation for a 32-bit memory location by writing the
* specified value to the the specified address.
*
* @param OutputPtr contains the address to perform the output operation
* at.
* @param Value contains the value to be output at the specified address.
*
* @return None
*
* @note None.
*
******************************************************************************/
#define XIo_Out32(OutputPtr, Value) \
(*(volatile u32 *)((OutputPtr)) = (Value))
總結
以上是生活随笔為你收集整理的Xilinx Xio控制sdr sdram的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 2023年天津天狮学院专升本市场营销专业
- 下一篇: 怎样让私服服务器彻底崩溃