Runtime direction specification of buffered ports

Technical questions regarding the XTC tools and programming with XMOS.
Redeye
XCore Addict
Posts: 131
Joined: Wed Aug 03, 2011 9:13 am

Runtime direction specification of buffered ports

Post by Redeye »

I'm working on an application which needs to use 32 bit buffered 1-bit ports, BUT the direction of data on those ports needs to be specifiable at runtime (depending on what connected hardware it finds at startup). They don't need to be bi-directional (I know this isn't possible anyway) because they're only ever going to be used in one direction, I just need to not specify the direction of data at compile time.

By specifying the ports as "buffered port:32", then initialising them with configure_in_port_no_ready() or configure_out_port_no_ready() when I know what direction I want the data to go in, the code seems to be working fine. The compiler gives me a warning :

warning: bidirectional buffered port not supported in hardware (port should have in or out qualifier)

but the code appears to run okay. I'm assuming that the in/out qualifier is therefore just a compiler safety check and is left out at your own risk.

Am I missing something here that's going to trip me up later? Or is what I'm doing basically fine as long as I make sure I don't try to use the ports bi-directionally?


User avatar
dan
Experienced Member
Posts: 102
Joined: Mon Feb 22, 2010 2:30 pm

Post by dan »

Yeah, you can get away with this. The sc_sdram_burst uses the same approach, for the bi-directional data bus (DQ).
Redeye
XCore Addict
Posts: 131
Joined: Wed Aug 03, 2011 9:13 am

Post by Redeye »

Thanks Dan. Appreciate the reassurance that I'm not missing something important.