Ruth Hendrix

Sharing Data between XGATE and CPU

Discussion created by Ruth Hendrix Employee on Jan 28, 2006
This message contains an entire topic ported from a separate forum. The original message and all replies are in this single message. We have seeded this new forum with selected information that we expect will be of value to you as you search for answers to your questions.
 
Posted: Fri Sep 16, 2005 7:31 am
 
Hello,

I want to transfer Data, which is produced by the CPU, over the SCI. The SCI is controlled by the XGATE. How can i share Data between the CPU and the XGATE? Are there any software examples? I'm using Codeworrier 4.1.

Posted: Fri Sep 16, 2005 7:50 am    
 
the easiest way is simply to declare a buffer or structure that both CPU and XGATE can see.
You can define this in either the XGATE source or the CPU source and it works in the same way that sharing data between any C source files works.
So starting from the wizard example you could declare a buffer in xgate.cxgate:
Code:
unsigned char buffer[10];

 
Then in main.c you would declare this as externally defined:
Code:
extern unsigned char buffer[];

 
Now both cores can write into and read buffer.

If you need to use a structure then define that in some common header.

You need to be careful that both are not writing the same location at the same time so consider using the hardware MUTEX semaphores on XGATE or some other scheme.
 
Posted: Fri Sep 16, 2005 8:24 am    
 
Thank's for your help

Outcomes