/** ALOE headers */ #include #include #include "typetools.h" #include "itf_types.h" #include "inputs.h" #include "outputs.h" #include "stats.h" int configured; int totalinputbits,totaloutputbits; int rcv[MAX_INPUT_CHANNELS]; extern int currentInterfaceIdx; int temp[MAX_INPUT_CHANNELS*INPUT_MAX_DATA]; int offsets_r[MAX_INPUT_CHANNELS],offsets_w[MAX_INPUT_CHANNELS]; int process_input(int len) { int offset; int i; int ch; if (!configured) return 1; ch=currentInterfaceIdx-1; if (ch>MAX_INPUT_CHANNELS) { Log("ChMux: Invalid receiving interface (%d)\n",currentInterfaceIdx); return 0; } if (lenINPUT_MAX_DATA) { Log("ChMux: Invalid control packet: Input data exceeds input buffer (%d>%d)\n",ctrlpkt.input_channel_length[i],INPUT_MAX_DATA); return 0; } input_itfs[i+1].buffer = input_data[i]; input_itfs[i+1].max_buffer_len = typeSizeArray(datatype,ctrlpkt.input_channel_length[i]); rpm+=typeSizeArray(datatype,ctrlpkt.input_channel_length[i]); offsets_r[i] = totalinputbits; totalinputbits+=ctrlpkt.input_channel_length[i]; } totaloutputbits=0; wpm=0; for (i=0;iINPUT_MAX_DATA) { Log("ChMux: Invalid control packet: Output data exceeds output buffer (%d>%d)\n",ctrlpkt.output_channel_length[i],INPUT_MAX_DATA); return 0; } output_itfs[i].buffer = output_data[i]; output_itfs[i].max_buffer_len = typeSizeArray(datatype,ctrlpkt.output_channel_length[i]); wpm+=typeSizeArray(datatype,ctrlpkt.output_channel_length[i]); offsets_w[i] = totaloutputbits; totaloutputbits+=ctrlpkt.output_channel_length[i]; } if (totalinputbits!=totaloutputbits) { Log("ChMux: Invalid control packet: Input and output lengths are not equal (%d!=%d)\n",totalinputbits,totaloutputbits); return 0; } Log("ChMux: input_channels=%d, output_channels=%d, length=%d\n",ctrlpkt.nof_input_channels,ctrlpkt.nof_output_channels,totalinputbits); return 1; } /** Run function. * @return 1 if ok, 0 if error */ int RunCustom() { int i,j; if (configured) { for (i=0;iMAX_INPUT_CHANNELS) { Log("Caution exceed maximum input chanels (%d>%d)\n",input_channels,MAX_INPUT_CHANNELS); input_channels=MAX_INPUT_CHANNELS; } if (output_channels>MAX_OUTPUT_CHANNELS) { Log("Caution exceed maximum output chanels (%d>%d)\n",output_channels,MAX_OUTPUT_CHANNELS); output_channels=MAX_OUTPUT_CHANNELS; } for (i=1;i