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
ports write implementation 相关文章:
- "Waveguide ports must be aligned with Cartesian coordinate planes" error
- Adding ports to know resistance at some point in 2-patch antenna
- [CST DS] Six ports Combination Using Couplers
- Cascading networks with >2 ports
- How many ports (min and max) ports a SIW antenna can have ? and why?
- Interdigital lines As input or output ports
