Syntax for partin() in select case statement Topic is solved

Technical questions regarding the XTC tools and programming with XMOS.
Post Reply
User avatar
dsteinwe
XCore Addict
Posts: 144
Joined: Wed Jun 29, 2016 8:59 am

Syntax for partin() in select case statement

Post by dsteinwe »

Hello,

is it possible to use the function partin(my_32bit_buffered_port, count) in a select case statement? My intention is, that the case block is only triggered, when "count" bits are read from the port into the port's shift buffer. I need a syntax like "case my_32bit_buffered_port :> my_var: ..." but with a different number of bits.


View Solution
User avatar
dsteinwe
XCore Addict
Posts: 144
Joined: Wed Jun 29, 2016 8:59 am

Post by dsteinwe »

I think, it is not possible, because you can only use the operators :> and <: in the case-statement to read and write resources. Resource can only be ports, timers or channels, but a function like partin() is not a resource. Therefore I guess, it is not possible.
User avatar
dsteinwe
XCore Addict
Posts: 144
Joined: Wed Jun 29, 2016 8:59 am

Post by dsteinwe »

It's possible with inline assembler like this:

Code: Select all

asm("setpsc res[%0], %1" :: "r"(p_in), "r"(bit_width));
For more informations look here: https://www.xcore.com/viewtopic.php?f=2 ... 974#p33974
Post Reply