XGate Function Call

cancel
Showing results for 
Search instead for 
Did you mean: 

XGate Function Call

1,849 Views
Thanga
Contributor I

Hi,

I am using MC9S12XDP512CAG controller, in my controller I have registered the SCI interrupt as a XGate interrupt. Main file have one ReadUart() function.XGate file have one WriteUart() function.  1.       Is it possible to call the ReadUart() function from xGate.

 2.       Is it possible to call the WriteUart() function from main.Kindly please help on this. 

 

Regards

Thanga…..

Labels (1)
0 Kudos
5 Replies

132 Views
Steve
NXP Employee
NXP Employee

To be clear:

ReadUart runs on the CPU and WriteUart runs on the XGATE?

 

If so then you can cause the other core to run these functions but you cannot run the functions on the wrong core. This means that the XGATE cannot call the ReadUart function as a normal function call and the same for the CPU and WriteUart.

However, you can cause the other core to run these functions on demand. This is normally done using interrupts. You should have a clear understanding of the interrupt controller and the XGATE interrupt request feature before writing any code. There is lots of support examples for XGATE on this website, the concurrent computing webinar is certainly worth a look for this type of application.

XGATE can send the SCI interrupt to the CPU at any time (since it is already routed to XGATE) and you could use this to cause the CPU to begin running the ReadUart function. If ReadUart is not an interrupt handler on the CPU then you must call it from a dedicated ISR. See AN3144

An alternative solution is to use one of the 8 XGATE software trigger interrupts. Have one point to XGATE and the WriteUart function and one point to the CPU and the ReadUart function (or a handler that calls it).

0 Kudos

132 Views
asdqwe
Contributor I

That is to say, It is impossiblly to call a funtion from c file in the xgate interrupt.

And you can't call any function from c library at all. Am I right?

0 Kudos

132 Views
kef
Specialist I

What tool suite you are using? CW? If so then both answers are NO. You can't call XGATE functions from CPU12X. Also you can't call CPU12X functions from XGATE. You have two CPUs (CPU12X CPU, and XGATE CPU) in one chip with different instruction sets. Function compiled for CPU12X won't work with XGATE, also function compiled for XGATE won't work with CPU12X.

 

But you may trigger XGATE software threads from CPU12X, and cause CPU12X interrupt from XGATE. CW default XGATE enabled project shows how to trigger XGATE software threads, see SetupXGATE() and

  /* force execution of software trigger 0 handler */
  XGSWT= 0x0101;

0 Kudos

132 Views
rodrigo_such
Contributor I

Hi

in your answer you sad "What tool suite you are using? CW? If so then both answers are NO."

Is there any tool suite that make it possible!? i mean, Is there any tool that can compile my code for both processors in order to make possible I run my library in XGate just "calling" the librarie's functions?

0 Kudos

132 Views
kef
Specialist I

In CW you can have two identical sets of source files:  *.c files for CPU12X and *.cxgate files for XGATE. You may have two sets of identical functions, one defined in *.c and compiled for CPU12X, and another one defined in *.cxgate and compiled for XGATE. Functions are not shared between cores, linker won't link call from CPU12X to XGATE function or opposite. But global scope variables are shared between cores and linker will be not happy to see two identical variables defined in different files.

0 Kudos