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))


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值