Custom select cases

Technical questions regarding the XTC tools and programming with XMOS.
Post Reply
User avatar
skoe
Experienced Member
Posts: 94
Joined: Tue Apr 27, 2010 10:55 pm
Contact:

Custom select cases

Post by skoe »

Hi,

can I implement custom select cases e.g. by using inline assembly? I want to wait for a channel end to become ready but not let XC do the usual handshake (INCT, OUTCT...).

Thanks in advance.


richard
Respected Member
Posts: 318
Joined: Tue Dec 15, 2009 12:46 am

Post by richard »

You can use the byref builtins defined in in xs1.h in select cases. This builtins translate directly to single instructons, there will be no handshake. For example:

Code: Select all

case inuint_byref(c, value):
  ...
  break;
What are you trying to achieve? Streaming channels also allow communication with handshaking. These may be more appropriate depending on what you want to do.
User avatar
skoe
Experienced Member
Posts: 94
Joined: Tue Apr 27, 2010 10:55 pm
Contact:

Post by skoe »

Thanks, I'll try it as soon as I finished the code snippet I'm working on. It seems it may be useful to dig a bit more in the header files :)
What are you trying to achieve?
To say it in BSD sockets words: Want to communicate not in the connect + send way but in the sendto way for IPC. I did it in assembly before, it worked very well. When I switched to XC (the select statement looks much better then assembly), I noticed that there is a handshake token sent be the receiver channel end to the other channel end. And if the sender is a third channel end, the response token goes to the "wrong" channel end.

To make it shorter: I'll go on and play around with this stuff by myself. Don't want to keep you from you work with more questions, at least not now :)

Regards,
Thomas
User avatar
skoe
Experienced Member
Posts: 94
Joined: Tue Apr 27, 2010 10:55 pm
Contact:

Post by skoe »

Great, it works now, exactly what I want.

Still need some inline assembly for this and that, but xs1.h contains many functions which make it easier to use low-level features of the XMOS.

Regards,
Thomas
Post Reply