////////////////////////////////////////////////////////////////////////////////////////// // // // FILE: puncturing_imp.c // // // // DESCRIPTION: WIMAX puncturing // // // // Input: control_flow_in; data_flow_in // // // // Output: data_flow_out // // // //June 2009 // ////////////////////////////////////////////////////////////////////////////////////////// /** ALOE headers */ #include #include #include #include "itf_types.h" #include "inputs.h" #include "outputs.h" #include "stats.h" #include "typetools.h" #include "puncturing_code.h" #define BSIZE 8192 /*GLOBAL VARIABLES*/ int data_rcved; //Data received-->data_rcved=1 //Data non received-->data_rcved=0 float punct_rateg; int pseqlength; int punctseq[MAXPSEQ]; #define NUMCHARSBYTE 8 /*PREDEFINED FUNCTIONS*/ void Init_Controlfunction(); int datainflow_bypass(int len); void Init_puncturing(); ////////////////////////////////////////////////////////////////////////////////////////// //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("puncturing: process_inputdata\n"); data_rcved=1; //The execution of this function implies that enough data has //been received //Testing flows purposes if(control_puncturing[0].CExec.status==TEST_FLOW)datainflow_bypass(len); //Testing module processing functionality if(control_puncturing[0].CExec.status==TEST_PROCESS)test_puncturing(); //Normal puncturing encoder execution if(control_puncturing[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_puncturing[0].CExec.status==TEST_FLOW) length=control_puncturing[0].CData.ninputdata; //Data send=Data received //Testing module processing functionality if(control_puncturing[0].CExec.status==TEST_PROCESS) length=0; //No data send //Normal execution if(control_puncturing[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_puncturing(); return 1; } int RunCustom() { return 1; } ////////////////////////////////////////////////////////////////////////////////////////// //END SQUELETON CALLED FUNCTIONS////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////// //######################################################################################// ////////////////////////////////////////////////////////////////////////////////////////// //ESPECIFIC MODULE FUNCTIONS////////////////////////////////////////////////////////////// //CONTROL////////////////////////////////////////////////////////////////////////CONTROL// ////////////////////////////////////////////////////////////////////////////////////////// void Init_Controlfunction() { control_puncturing[0].CExec.status=NONACTIVE; control_puncturing[0].CData.ninputdata=0; control_puncturing[0].CData.noutputdata=0; } void Init_puncturing(){ /* Variables Inicialization */ } int control_length() { return(INPUT_MAX_CONTROL); } int process_control_input(int len) { int i; if(len==1){ //CAPTURE CONFIG punct_rateg=control_puncturing[0].CData.punct_rate; //PRINT CONFIG VALUES printf("O---->PUNCTURING (config):........................................TSLOT%d\n",\ control_puncturing[0].CExec.timeslot); printf("O STATUS: %d \n",\ control_puncturing[0].CExec.status); printf("O NumInputdata=%d, NumOutputdata=%d\n",\ control_puncturing[0].CData.ninputdata,\ control_puncturing[0].CData.noutputdata); pseqlength=control_puncturing[0].CData.pseqlength; printf("O puncturing rate=%4.2f pseqlength=%d\n",\ punct_rateg, pseqlength); printf("O Puncturing Sequence="); for(i=0; i0){ //READ INPUT BUFFER // printf("puncturing input\n"); for(i=1; i<=length; i++){ info_A[i-1]=input_data[i-1]; // printf(" %d", (int)input_data[i-1]); // if(i%16 == 0)printf("\n"); } // printf("\n"); // for(i=0; i