Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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

Status
Not open for further replies.

sai685

Junior Member level 2
Joined
Sep 4, 2015
Messages
23
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
292
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.
The below is not doing perfectly
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
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top