Work sent to and from clients via a FarmPort
Suitable for block-level operations.
Block sequence ensured by network ? Presentation layer checks anyway.
[Kiwi.Hardware()]
public static void Main()
{ int k = 0;
yy_ch.Reset();
work_led = false; poll_led = true; tx_led = false;
while(true)
{ rx_led = true;
uint len = FarmPort.ArrayRead(workbuf); // ----> Blocking wait for work packet
rx_led = false;
yy_ch.Reset(); vv_ch.Reset(); uu_ch.Reset();
work_led = true;
for (int i=0; i < len; i+=3) // Work loop
{ workbuf[i+0] = yy_ch.convolve((int)workbuf[i+0]);
workbuf[i+1] = uu_ch.convolve((int)workbuf[i+1]);
workbuf[i+2] = vv_ch.convolve((int)workbuf[i+2]);
poll_led = !poll_led;
}
work_led = false; tx_led = true;
FarmPort.ArrayWrite(workbuf, len); // <----Send result data out.
tx_led = false;
}
}