AXI_GPIO

通过添加AXI_GPIO,直接在AXI接口上了。相关的胶连逻辑自动生成了。具体的AXI 与GPIO之间,怎么通过总线访问,总线又是怎么给各模块映射地址,要看IP模块的手册,和开发流程有关的文档。

通过自动分配地址,以下是寄存器访问内存一种方式

#define GPIO_BASEADDR 0x41200000

#define DATA_OFFSET  0x0  //数据
#define TRI_OFFSET   0x4  //方向

#define LED_DELAY     10000000

int main()
{
	volatile int Delay;
	/* Set the direction for all signals as outputs */
	*(int *)(GPIO_BASEADDR + TRI_OFFSET) = 0x0 ;  //方向的设置  这是从基地址开始+偏移地址算的  查看手册这里    设置为输出

  while (1) {
	/* Set the LED to High */
	*(int *)(GPIO_BASEADDR + DATA_OFFSET) = 0xF ;

	/* Wait a small amount of time so the LED is visible */
	for (Delay = 0; Delay < LED_DELAY; Delay++);

	/* Set the LED to Low */
	*(int *)(GPIO_BASEADDR + DATA_OFFSET) = 0x0 ;

	/* Wait a small amount of time so the LED is visible */
	for (Delay = 0; Delay < LED_DELAY; Delay++);
    }
return 0;
}

以下参考:
https://blog.csdn.net/xiong_xin/article/details/115025668

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值