Simple concurrency question.

Technical questions regarding the XTC tools and programming with XMOS.
Boscoe
New User
Posts: 3
Joined: Sun Feb 14, 2016 8:10 pm

Simple concurrency question.

Post by Boscoe »

I would just like some clarification and guidance on this query.

I'm currently using the startKit to demo my hardware. I'm creating a device that drives a linear CCD and bursts the data to an FTDI device at around 8MBs. I was envisaging the main thread of the program to generate the CCD clock signals based on the configuration data I send from the PC before the scanner starts. Every pixel I want this thread to call a function to execute on another core that reads and handles the data from the ADC - the data returned from it will go into an array the same length as the image sensor array. After every line this main thread should call the function to send the 2kB of data, again on another core. My question is about disjointedness I believe.

So if I call the function:

Code: Select all

bytesWritten = FT_Write(data, bytesToWrite, timeOut);
like this:

Code: Select all

on stdcore[1] : bytesWritten = FT_Write(data, bytesToWrite, timeOut);
the main thread should continue but when and how is the variable bytesWritten returned?

Could someone point me to a good place to read about concurrency on Xmos devices?

Thanks


User avatar
Folknology
XCore Legend
Posts: 1274
Joined: Thu Dec 10, 2009 10:20 pm

Post by Folknology »

Boscoe wrote: ...
like this:

Code: Select all

on stdcore[1] : bytesWritten = FT_Write(data, bytesToWrite, timeOut);
...
Thanks
Task from cores don't return anything they are normally void. In order to get data from one core to another you can use channels,interfaces or some safe memory sharing.

e.g. interface

Code: Select all

interface adc_i {
  unsigned bytesWritten FT_Write(int data[Btw], unsigned Btw, unsigned timeOut);
};
The ADC core could be the server and the other core the client of this interface.

*Actually re-reading your question I may have it the wrong way around but interfaces can be used all the same, just change server and client.

regards
Al