Thanks for the hint.
For avoiding code multiplication I have tried to use a select function.
Code: Select all
static inline select receiverCases(
RxDesc & rxDesc,
boolean & readEnabled,
boolean & availableEnabled,
boolean & defaultEnabled,
server interface ComRxIf rxIf
) {
case (readEnabled && rxDesc.buf.items) => rxIf.read() -> char ch:
CharBuffer_get(rxDesc.buf, ch);
if (rxDesc.read >= 64) {
// yield
rxDesc.read = 0;
readEnabled = FALSE;
defaultEnabled = TRUE;
} else {
++rxDesc.read;
}
break;
case availableEnabled => rxIf.available() -> uint res:
availableEnabled = FALSE;
defaultEnabled = TRUE;
res = rxDesc.buf.items;
break;
}
And to call it from "select"
Code: Select all
while (TRUE) {
select {
// --- receive
case receiverCases(rxDesc[0], readEnabled[0], availableEnabled[0], defaultEnabled, rxIf[0]);
In this case the compilation crashes in a late phase:
Code: Select all
Compiling Com.xc
xcc1: terminated due to internal unrecoverable error
For bug reporting instructions, please see:
http://www.xmos.com/support
xmake[1]: *** [.build/src//Com.xc.o] Error 1
xmake: *** [bin//USB_PWM.xe] Error 2
Is it possible to open and track bugs for XMOS tools?