Extending interfaces

Technical questions regarding the XTC tools and programming with XMOS.
User avatar
Folknology
XCore Legend
Posts: 1274
Joined: Thu Dec 10, 2009 10:20 pm

Extending interfaces

Post by Folknology »

Looking at the extended interface example provided in the programming guide : https://www.xmos.com/support/tools/prog ... 53&page=23

Code: Select all

interface uart_tx_if {
   void output_char(uint8_t data);
};
...
extends client interface uart_tx_if : {
   void output_string(client interface uart_tx_if self,
                      uint8_t data[n], unsigned n) {
     for (size_t i = 0; i < n; i++) {
       self.output_char(data[i]);
     }
   }
}
Does the extended code wrapped around the original interface call run on the calling logical core (client, my assumption) or the Implementing core (server) assuming they are both on different cores (not combined)?

regards
Al


User avatar
xsamc
Active Member
Posts: 55
Joined: Fri Mar 04, 2011 3:38 pm

Post by xsamc »

My understanding is that the "extended" parts of an interface will run in the same place as the rest of the interface's methods, however the toolchain may be able to perform additional optimisation in stripping out unused extended methods.

I'll see if I can get confirmation on this.
Cheers,
Sam