微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 微波和射频技术 > 天线设计和射频技术 > How to write to a memory ports using c for SoC implementation?

How to write to a memory ports using c for SoC implementation?

时间:04-04 整理:3721RD 点击:
The below is not doing perfectly as per my question.so clarify me regarding this .
Code:
#include<stdio.h>    
#define base_addr 0x20000000

int *GPIO1=(int *)base_addr+0x00;
int *GPIO2=(int *)base_addr+0x04;
int *GPIO3=(int *)base_addr+0x08;
int *GPIO4=(int *)base_addr+0x0c;

int main()
{
 int a=4,b=5,c=6,d=7;

 *GPIO1=a;
 *GPIO2=b;
 *GPIO3=c;
 *GPIO4=d;

 printf("GPIO1=%d,GPIO2=%d,GPIO3=%d,GPIO4=%d",GPIO1,GPIO2,GPIO3,GPIO4);
}

what is your requirement ?
specify clearly.
do you want to write the integers at GPIO1 ... or at *GPIO1...

Everything looks correct, except for the printf() line.
How did you check? The printf() is not reading back the memory content, you want to read *GPIO1....

The basic idea is i want to write an write operation to GPIO peripheral. In the same way a write to all the peripherals and to memory which should have base address is common whereas offset keeps changing. as above

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top