////////////////////////////////////////////////////////////////////////////////////////// // // // FILE: depuncturing_imp.c // // // // DESCRIPTION: WIMAX depuncturing // // // // Input: control_flow_in; data_flow_in // // // // Output: data_flow_out // // // //June 2009 // ////////////////////////////////////////////////////////////////////////////////////////// /** ALOE headers */ #include #include #include #include "inputs.h" #include "outputs.h" #include "stats.h" #include "typetools.h" #include "puncturing_code.h" #include "CDepuncturing.h" #define BSIZE 8192 /*GLOBAL VARIABLES*/ int data_rcved; //Data received-->data_rcved=1 //Data non received-->data_rcved=0 float depunct_rateg; int pseqlength; int punctseq[MAXPSEQ]; #define NUMCHARSBYTE 8 /*PREDEFINED FUNCTIONS*/ void Init_Controlfunction(); int datainflow_bypass(int len); void Init_depuncturing(); ////////////////////////////////////////////////////////////////////////////////////////// //SQUELETON CALLED FUNCTIONS////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////// //CONTROL ////////////////////////////////////////////////////////////////////////CONTROL/ ////////////////////////////////////////////////////////////////////////////////////////// //INPUT/////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////// /*Returns the length(in control in type words) of the expected control flow at each */ /*time-slot */ /*Funtion activated if control flow has been received */ /*Check INPUT_MAX_CONTROL */ int get_controlin_length(){ int length=1; length=control_length(); 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 */ int process_inputcontrol(int len){ process_control_input(len); return(1); /*return 1 if OK; return 0 if error*/ } ////////////////////////////////////////////////////////////////////////////////////////// //OUTPUT////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////// /*Returns the length (in control out type words) of the generated control flow at each */ /*time-slot */ /*Check OUTPUT_MAX_CONTROL */ int get_controlout_length(){ int length=1; return(length); } /*Generate the control word to be send according the length provided by */ /*get_controlout_length() */ /*"len" indicates the number of control words to be generated */ int generate_outputcontrol(int len){ /*return 1 if OK; return 0 if error*/ return(1); } ////////////////////////////////////////////////////////////////////////////////////////// //DATA/////////////////////////////////////////////////////////////////////////////DATA/// ////////////////////////////////////////////////////////////////////////////////////////// //INPUT/////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////// /*Returns the length(in data in type words) of the expected data flow at each time-slot */ //Funtion activated only if data flow has been received */ /*Check INPUT_MAX_DATA */ int get_datain_length() { int length=1; length=datain_length(); return(length); } /*Process the received data flow according to the length returned by get_datain_length()*/ /** Run function. return 1 if ok, 0 if error */ /*"len" indicates the number of data words to be processed */ int process_inputdata(int len) { //printf("depuncturing: process_inputdata\n"); data_rcved=1; //The execution of this function implies that enough data has //been received //Testing flows purposes if(control_depuncturing[0].CExec.status==TEST_FLOW)datainflow_bypass(len); //Testing module processing functionality if(control_depuncturing[0].CExec.status==TEST_PROCESS)test_depuncturing(); //Normal depuncturing encoder execution if(control_depuncturing[0].CExec.status==ACTIVE)process_datainflow(len); return 1; } ////////////////////////////////////////////////////////////////////////////////////////// //OUTPUT////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////// /*Returns the length (in data out type words) of the generated data flow at each */ /*time-slot */ int get_dataout_length() { int length; length=0; if(data_rcved==0)return(length); data_rcved=0; //Testing flows purposes if(control_depuncturing[0].CExec.status==TEST_FLOW) length=control_depuncturing[0].CData.ninputdata; //Data send=Data received //Testing module processing functionality if(control_depuncturing[0].CExec.status==TEST_PROCESS) length=0; //No data send //Normal execution if(control_depuncturing[0].CExec.status==ACTIVE) length=dataout_length(); return(length); } /*Generate the control word to be send according the length provided by */ /*get_controlout_length() */ /** Run function. return 1 if ok, 0 if error */ /*"len" indicates the number of data words to be generated */ int generate_outputdata(int len) { return 1; } int InitCustom() { data_rcved=0; Init_Controlfunction(); void Init_depuncturing(); return 1; } int RunCustom() { return 1; } ////////////////////////////////////////////////////////////////////////////////////////// //END SQUELETON CALLED FUNCTIONS////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////// //######################################################################################// ////////////////////////////////////////////////////////////////////////////////////////// //ESPECIFIC MODULE FUNCTIONS////////////////////////////////////////////////////////////// //CONTROL////////////////////////////////////////////////////////////////////////CONTROL// ////////////////////////////////////////////////////////////////////////////////////////// void Init_Controlfunction() { control_depuncturing[0].CExec.status=NONACTIVE; control_depuncturing[0].CData.ninputdata=0; control_depuncturing[0].CData.noutputdata=0; } void Init_depuncturing(){ /* Variables Inicialization */ } int control_length() { return(INPUT_MAX_CONTROL); } int process_control_input(int len) { int i; if(len==1){ //CAPTURE CONFIG depunct_rateg=control_depuncturing[0].CData.punct_rate; //PRINT CONFIG VALUES printf("O---->DEPUNCTURING (config): TSLOT%d, STATUS=%d\n",\ control_depuncturing[0].CExec.timeslot,\ control_depuncturing[0].CExec.status); printf("O NumInputdata=%d, NumOutputdata=%d\n",\ control_depuncturing[0].CData.ninputdata,\ control_depuncturing[0].CData.noutputdata); pseqlength=control_depuncturing[0].CData.pseqlength; printf("O depuncturing rate=%4.2f pseqlength=%d\n",\ depunct_rateg, pseqlength); printf("O dePuncturing Sequence="); for(i=0; i=BSIZE)printf("depuncturing(datainflow_bypass)ERROR len > BSIZE\n"); for(i=0; i0){ //READ INPUT BUFFER // printf("depuncturing input\n"); for(i=1; i<=length; i++){ info_A[i-1]=input_data[i-1]; // printf(" %4.2f", input_data[i-1]); // if(i%16 == 0)printf("\n"); } // printf("\n"); //------DEPUNCTURING // printf("DEPUNCTURING: proces_data:length=%d, outlength=%d\n",\ length, outlength); // printf("DEPUNCTURING: proces_data:pseqlength=%d\n",\ pseqlength); length=depuncturing(punctseq, pseqlength, length, outlength,\ info_A, info_B); // printf("DEPUNCTURING OUTPUT: puncturing TEST PROCESS\n"); for(i=1; i<=length; i++)output_data[i-1]=info_B[i-1]; /* printf("depuncturing output: length=%d\n", length); for(i=1; i<=length; i++){ printf(" %4.2f", output_data[i-1]); if(i%16 == 0)printf("\n"); } printf("\n"); */ // printf("depuncturing: proces_data: output length=%d\n", length); } } int dataout_length() { int length; length=control_depuncturing[0].CData.noutputdata; //printf("depuncturing: dataout_length2: length=%d\n", length); return(length); } int generate_dataflow(int len) { int i; return(1); } #define TESTLENGTH 35 #define BSIZE2 500 int test_depuncturing(int length){ } void ConfigInterfaces(){} ////////////////////////////////////////////////////////////////////////////////////////// //END OF ESPECIFIC MODULE FUNCTIONS/////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////