/** Sample ALOE component implementation file */ /** Include SW API header and SW API utils (skeleton) */ #include #include /** Include general data type library */ #include "typetools.h" /** include input/output interfaces and stats. * itf_types.h must be included 'before' input.h if it defines e.g. control * interface packet structure */ #include "itf_types.h" #include "inputs.h" #include "outputs.h" #include "stats.h" #include "puncturing_code.h" /*GLOBAL VARIABLES & BUFFERS*/ CDepunc_h ctrl; int configured=0; int input_temp[INPUT_MAX_DATA*8],output_temp[OUTPUT_MAX_DATA*8]; /* PREDEFINED FUNCTIONS*/ int datainflow_bypass(int len,int numTS,int print,int numcols,int dattype); void check_config(); /*----------------------- SQUELETON CALLED FUNCTIONS ------------------------*/ /** INPUT INTERFACE 1: CONTROL //////////////////////////////////////////CONTROL * controlin_length() Returns the maximum length (in control type words) of the * expected control flow at each time-slot * Funtion activated if control flow has been received */ int controlin_length() { int length=INPUT_MAX_CONTROL; return(length); } /** Process the received control flow according to the length returned by * get_controlin_length() "len" indicates the number of control words to be * processed * This is the processing function for the control interface. Here, we simply * have to validate the parameters and update our internal state variables. */ int process_inputcontrol(int len) { int i; if(len<=0)return(1); configured=1; //CAPTURE MODULE CONFIG memcpy(&ctrl,&ctrlpkt,sizeof(CDepunc_h)); //PRINT CONFIG VALUES xprintf("O---->GEN_DEPUNCT (config): CONFIG BY CONTROL ITF\n"); xprintf("O---->GEN_DEPUNCT (config): TSLOT%d, STATUS=%d\n",\ ctrl.time_slot,\ ctrl.status); xprintf("O NumInputdata=%d, NumOutputdata=%d\n",\ ctrl.inputdatalength,\ ctrl.outputdatalength); xprintf("O depuncturing rate=%4.2f pseqlength=%d\n",\ ctrl.punct_rate, ctrl.pseqlength); xprintf("O dePuncturing Sequence="); for(i=0; iINPUT_MAX_DATA) { //sprintf(str,"MODULENAME: Invalid inputdatalength parameter. %d > %d\n",\ // inputdatalength,INPUT_MAX_DATA); //WriteLog(1,str); return(0); } /*return 1 if OK; return 0 if error*/ return(1); } /** END INPUT INTERFACE 1: CONTROL /////////////////////////////////////CONTROL /** INPUT INTERFACE 2: DATA ///////////////////////////////////////////////DATA * datain_length() Returns the maximum length (in data type words) of the * expected data flow at each time-slot * Funtion activated if data flow has been received */ int datain_length() { int length=typeSizeArray(datatypeIN, ctrl.inputdatalength); return(length); } /** Process the received data flow according to the length returned by * datain_length(). Run function. return 1 if ok, 0 if error. * "len" indicates the number of data words to be processed * This is the main processing function. It will be called every time * data is available for process. Here you will place your signal processing * code. */ int process_inputdata(int len) { int i; float maxIN, escale, *temp; static int count2=0; /*Check if configured*/ if (!configured)return(1); /** In general, we want to make sure we have received the expected * amount of data. * The function typeSizeArray() returns the expected bytes as a function * of a general datatype and expected number of elements. For example, if * blockLength=128 and datatype is INTEGER, it returns 128*4=512. * If for example the datatype is BITSTREAM the function will * return 128/8=16 */ /*NO LOG FILE*/ if (lenGEN_DEPUNCT (config): CONFIG BY STATS.h\n"); xprintf("O---->GEN_DEPUNCT (config): TSLOT%d, STATUS=%d\n",\ ctrl.time_slot,\ ctrl.status); xprintf("O NumInputdata=%d, NumOutputdata=%d\n",\ ctrl.inputdatalength,\ ctrl.outputdatalength); xprintf("O---->datatypeIN=%d, datatypeOUT=%d\n",\ datatypeIN,datatypeOUT); xprintf("O-----------------------------------------0\n"); } if(one<=ctrl.time_slot)one++; }