Max of 1 channel off core in a thread?

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
lilltroll
XCore Expert
Posts: 956
Joined: Fri Dec 11, 2009 3:53 am
Location: Sweden, Eskilstuna

Post by lilltroll »

paul wrote:In reply to your post here: https://www.xcore.com/forum/viewtopic.php?p=6589#p6589 (which says you didn't quite get your answer to your original question).

If you are using XC and not using streaming channels then it should do the arbitration for you. The only situation where it will look like this is not working is when you have a thread blocking because it is not receiving the data. The channel will remain open until the other end picks up the data.

Using these 'normal' channels (just declared using the chan and chanend types) you would see something like this on the producer and consumer sides respectively:

Code: Select all

outct res[r10], 0x1
chkct res[r10], 0x1
out r0, res[r10]
outct res[r10], 0x1
chkct res[r10], 0x1

Code: Select all

chkct res[r10], 0x1
outct res[r10], 0x1
in r0, res[r10]
chkct res[r10], 0x1
outct res[r10], 0x1
Obviously in between the outct and chkct's you can put as many in/outs as you want if you want to send multiple lumps of data - this is what a transaction does.

This is all you should need for multiple channels across a single link. In fact if you are just using XC then this should all be transparent if you are not using streaming channels and your threads are taking data off their respective channels in time.

Hope that helps,
The problem for me is the:
asm("setd res[%0],%1" ::"r"(Chanend),"r"((ServerCore<<16)+0x102));

It is only active with one channelend in the time, but I hope the last message is helping me.


Probably not the most confused programmer anymore on the XCORE forum.
User avatar
lilltroll
XCore Expert
Posts: 956
Joined: Fri Dec 11, 2009 3:53 am
Location: Sweden, Eskilstuna

Post by lilltroll »

richard wrote:
lilltroll wrote:What happens with control tokens that are sent to a loose end?
If 3 clients are sending a EOM tokens to the same destination at the same time, maximum one will reach the receiver, (the one that the receiver has connected to)
What happens with the other 2 tokens? And what way is best to handle this?
In this case no data is lost - all data will be received eventually.

A packet is formed from when you start sending data on a channel end to when you send a CT_END control token. If a packet arrives while a channel end is in the middle of receiving another packet then the new packet waits until the first packet has been input by the receiver. The waiting packet will sit in the buffers in the route between the channel ends, making links along that route unavailable for other traffic while it is waiting. If the packet is bigger than the available buffering then the sender thread will pause when the buffers become full.
But if the CT_END sent by a client is waitning in the FIFO, it should later arive to the server when that link is set up. The server will sends back a CT_END.
But that doesn't happend. The client never get an answer.
Probably not the most confused programmer anymore on the XCORE forum.