#include #include #include #include "../../wimax_datasource/interfaces/itf_types.h" #include "../../wimax_rando/interfaces/itf_types.h" #include "../../wimax_rsolomon/interfaces/itf_types.h" #include "../../gen_cconv/interfaces/itf_types.h" #include "../../wimax_interleaver/interfaces/itf_types.h" #include "../../wimax_puncturing/interfaces/itf_types.h" #include "../../wimax_symbolmap/interfaces/itf_types.h" #include "../../wimax_channel/interfaces/itf_types.h" #include "../../wimax_symboldemap/interfaces/itf_types.h" #include "../../wimax_deinterleaver/interfaces/itf_types.h" #include "../../gen_depunct/interfaces/itf_types.h" #include "../../gen_viterbi/interfaces/itf_types.h" #include "../../wimax_dersolomon/interfaces/itf_types.h" #include "../../wimax_derando/interfaces/itf_types.h" #include "../../wimax_datasink/interfaces/itf_types.h" #include "control_modules.h" #include "wimaxTxControl.h" //Defines all the WIMAX control parameters #define OUTPUT_MAX_CONTROL 1 //////////////////////////////////////////////////////////////////////////////// void control_DataSource(int *chainPosition,\ int *timeSLOT,\ int *numdataout,\ CDataSource *Cdatasource,\ CWimax *WIMAXctrl) { static int onlyone=0; if((*timeSLOT==*chainPosition) && (onlyone==0)){ Cdatasource->CExec.status=ACTIVE; Cdatasource->CExec.timeslot=*timeSLOT; Cdatasource->CData.numdatabytes=WIMAXctrl->uncodedbytes; *numdataout=WIMAXctrl->uncodedbytes; printf("WIMAX_CONTROL_CCNEW: DATASOURCE: TSLOT%d, STATUS=%d\n",\ Cdatasource->CExec.timeslot,\ Cdatasource->CExec.status); printf("WIMAX_CONTROL_CCNEW: DATASOURCE: numdatabytes=%d\n",\ Cdatasource->CData.numdatabytes); (*chainPosition)++; onlyone=1; } } //////////////////////////////////////////////////////////////////////////////// void control_Rando(int *chainPosition,int *timeSLOT,int *numdatainout,\ CRando *ctrl_rando,CWimax *WIMAXctrl) { static int onlyone=0; if((*timeSLOT==*chainPosition) && (onlyone==0)){ ctrl_rando->CExec.status=ACTIVE; ctrl_rando->CExec.timeslot=*timeSLOT; ctrl_rando->CData.ninputbytes=*numdatainout; ctrl_rando->CData.noutputbytes=*numdatainout; // printf("WIMAX_TXC: RANDO: TSLOT%d, STATUS=%d, numINDATA=%d, numOUTDATA=%d\n",\ // ctrl_rando->CExec.timeslot,\ // ctrl_rando->CExec.status,\ // ctrl_rando->CData.ninputbytes,\ // ctrl_rando->CData.noutputbytes); (*chainPosition)++; onlyone=1; } } //////////////////////////////////////////////////////////////////////////////// void control_RSolomon(int *chainPosition,int *timeSLOT,int *numdatainout,\ CRsolomon *ctrl_rsolomon,CWimax *WIMAXctrl) { static int onlyone=0; if((*timeSLOT==*chainPosition) && (onlyone==0)){ ctrl_rsolomon->CExec.status=ACTIVE; ctrl_rsolomon->CExec.timeslot=*timeSLOT; ctrl_rsolomon->CData.ninputbytes=*numdatainout; ctrl_rsolomon->CData.noutputbytes=*numdatainout\ +WIMAXctrl->rsolomon; ctrl_rsolomon->CData.modulation=WIMAXctrl->modulation; ctrl_rsolomon->CData.rsolomon_Pbytes=WIMAXctrl->rsolomon; // printf("WIMAX_TXC: RSOLOMON: TSLOT%d, STATUS=%d, numINDATA=%d, numOUTDATA=%d\n",\ // ctrl_rsolomon->CExec.timeslot,\ // ctrl_rsolomon->CExec.status,\ // ctrl_rsolomon->CData.ninputbytes,\ // ctrl_rsolomon->CData.noutputbytes); // *numdatainout=ctrl_rsolomon->CData.noutputbytes; (*chainPosition)++; onlyone=1; } } //////////////////////////////////////////////////////////////////////////////// /*GPL CONVOLUTIONAL CODER */ void control_genCConvV2(int *chainPosition,int *timeSLOT,int *numdatainout,\ struct cconv_h *ctrl_cconv,CWimax *WIMAXctrl) { static int onlyone=0; if((*timeSLOT==*chainPosition) && (onlyone==0)){ //k=7 //{1, 1, 1, 1, 0, 0, 1} //{1, 0, 1, 1, 0, 1, 1}; if(WIMAXctrl->viterbiK==7){ ctrl_cconv->CCcoderate=2; ctrl_cconv->K=7; ctrl_cconv->long_block=(*numdatainout)*8; ctrl_cconv->num_blocks=1; ctrl_cconv->poly[0]=0x79; ctrl_cconv->poly[1]=0x5B; *numdatainout=\ (*numdatainout+WIMAXctrl->tail)*ctrl_cconv->CCcoderate; } //k=9 if(WIMAXctrl->viterbiK==9){ ctrl_cconv->CCcoderate=2; ctrl_cconv->K=9; ctrl_cconv->long_block=(*numdatainout)*8; ctrl_cconv->num_blocks=1; ctrl_cconv->poly[0]=0x1AF; ctrl_cconv->poly[1]=0x11D; *numdatainout=\ (*numdatainout+WIMAXctrl->tail)*ctrl_cconv->CCcoderate; } /* printf("WIMAX_TXC: CCONV: CODERATE%d, K=%d, long_block=%d, num_blocks=%d\n",\ ctrl_cconv.CCcoderate,\ ctrl_cconv.K,\ ctrl_cconv.long_block,\ ctrl_cconv.num_blocks); */ (*chainPosition)++; onlyone=1; } } void control_Puncturing(int *chainPosition,int *timeSLOT,int *numdatainout,\ CPuncture *ctrl_puncturing,CWimax *WIMAXctrl) { int i; static int onlyone=0; if((*timeSLOT==*chainPosition) && (onlyone==0)){ //control_puncturing[0].CExec.status=TEST_FLOW; //control_puncturing[0].CExec.status=TEST_PROCESS; ctrl_puncturing->CExec.status=ACTIVE; ctrl_puncturing->CExec.timeslot=*timeSLOT; ctrl_puncturing->CData.ninputdata=*numdatainout; ctrl_puncturing->CData.punct_rate=WIMAXctrl->punct_rate; ctrl_puncturing->CData.pseqlength=WIMAXctrl->pseqlength; for(i=0; iCData.puncseq[i]=\ WIMAXctrl->puncseq[i]; } if(ctrl_puncturing->CExec.status==ACTIVE){ ctrl_puncturing->CData.noutputdata=\ round((float)(ctrl_puncturing->CData.ninputdata)\ *(1.0)/WIMAXctrl->punct_rate); } if(ctrl_puncturing->CExec.status==TEST_FLOW){ ctrl_puncturing->CData.noutputdata=\ ctrl_puncturing->CData.ninputdata; } if(ctrl_puncturing->CExec.status==TEST_PROCESS){ ctrl_puncturing->CData.noutputdata=0; } // printf("WIMAX_TXC: PUNCTURING: TSLOT%d, STATUS=%d, numINDATA=%d, numOUTDATA=%d\n",\ // ctrl_puncturing->CExec.timeslot,\ // ctrl_puncturing->CExec.status,\ // ctrl_puncturing->CData.ninputdata,\ // ctrl_puncturing->CData.noutputdata); *numdatainout=ctrl_puncturing->CData.noutputdata; (*chainPosition)++; onlyone=1; } } //////////////////////////////////////////////////////////////////////////////// void control_Interleaver(int *chainPosition,int *timeSLOT,int *numdatainout,\ CInter *ctrl_inter, CWimax *WIMAXctrl) { int i; static int onlyone=0; if((*timeSLOT==*chainPosition) && (onlyone==0)){ //ctrl_inter.CExec.status=TEST_FLOW; //ctrl_inter.CExec.status=TEST_PROCESS; ctrl_inter->CExec.status=ACTIVE; ctrl_inter->CExec.timeslot=*timeSLOT; ctrl_inter->CData.modulation=WIMAXctrl->modulation; if(ctrl_inter->CExec.status==ACTIVE){ ctrl_inter->CData.ninputdata=*numdatainout; ctrl_inter->CData.noutputdata=\ ctrl_inter->CData.ninputdata; } if(ctrl_inter->CExec.status==TEST_FLOW){ ctrl_inter->CData.ninputdata=*numdatainout; ctrl_inter->CData.noutputdata=\ ctrl_inter->CData.ninputdata; } if(ctrl_inter->CExec.status==TEST_PROCESS){ ctrl_inter->CData.ninputdata=1152; ctrl_inter->CData.noutputdata=0; ctrl_inter->CData.modulation=_64QAM; } // printf("WIMAX_TXC: INTERLEAVER: TSLOT%d, STATUS=%d, numINDATA=%d, numOUTDATA=%d\n",\ // ctrl_inter->CExec.timeslot,\ // ctrl_inter->CExec.status,\ // ctrl_inter->CData.ninputdata,\ // ctrl_inter->CData.noutputdata); *numdatainout=ctrl_inter->CData.noutputdata; (*chainPosition)++; onlyone=1; } } //////////////////////////////////////////////////////////////////////////////// void control_SymbolMap(int *chainPosition,int *timeSLOT,int *numdatainout,\ CSimbolmap *ctrl_symbolmap, CWimax *WIMAXctrl) { int i; static int onlyone=0; if((*timeSLOT==*chainPosition) && (onlyone==0)){ //control_symbolmap.CExec.status=TEST_FLOW; //control_symbolmap.CExec.status=TEST_PROCESS; ctrl_symbolmap->CExec.status=ACTIVE; ctrl_symbolmap->CExec.timeslot=*timeSLOT; ctrl_symbolmap->CData.modulation=WIMAXctrl->modulation; if(ctrl_symbolmap->CExec.status==ACTIVE){ ctrl_symbolmap->CData.ninputdata=*numdatainout; ctrl_symbolmap->CData.noutputdata=\ ctrl_symbolmap->CData.ninputdata*BITSPERCHAR/\ ctrl_symbolmap->CData.modulation; } if(ctrl_symbolmap->CExec.status==TEST_FLOW){ printf("WIMAX_TXC: SYMBOLMAP: TEST_FLOW NON VALID OPTION\n"); } if(ctrl_symbolmap->CExec.status==TEST_PROCESS){ printf("WIMAX_TXC: SYMBOLMAP: TEST_PROCESS NON VALID OPTION\n"); } // printf("WIMAX_TXC: SYMBOLMAP: TSLOT%d, STATUS=%d, numINDATA=%d, numOUTDATA=%d\n",\ // control_symbolmap.CExec.timeslot,\ // control_symbolmap.CExec.status,\ // control_symbolmap.CData.ninputdata,\ // control_symbolmap.CData.noutputdata); *numdatainout=ctrl_symbolmap->CData.noutputdata; (*chainPosition)++; onlyone=1; } } //////////////////////////////////////////////////////////////////////////////// void control_Channel(int *chainPosition,int *timeSLOT,int *numdatainout,\ CChannel *ctrl_channel, CWimax *WIMAXctrl) { static int onlyone=0; if((*timeSLOT==*chainPosition) && (onlyone==0)){ //control_channel.CExec.status=TEST_FLOW; ctrl_channel->CExec.status=ACTIVE; ctrl_channel->CExec.timeslot=*timeSLOT; //control_channel.CData.ninputdata=control_puncturing[0].CData.noutputdata; ctrl_channel->CData.ninputdata=*numdatainout; ctrl_channel->CData.noutputdata=ctrl_channel->CData.ninputdata; ctrl_channel->CData.channel_mode=WIMAXctrl->channel_mode; ctrl_channel->CData.EbNo=WIMAXctrl->channelEbNo; // printf("WIMAX_TXC: CHANNEL: TSLOT%d, STATUS=%d, numINDATA=%d, numOUTDATA=%d\n",\ // control_channel.CExec.timeslot,\ // control_channel.CExec.status,\ // control_channel.CData.ninputdata,\ // control_channel.CData.noutputdata); *numdatainout=ctrl_channel->CData.noutputdata; (*chainPosition)++; onlyone=1; } } //////////////////////////////////////////////////////////////////////////////// void control_SymbolDeMap(int *chainPosition,int *timeSLOT,int *numdatainout,\ CSimboldemap *ctrl_symboldemap, CWimax *WIMAXctrl) { static int onlyone=0; if((*timeSLOT==*chainPosition) && (onlyone==0)){ //control_symboldemap.CExec.status=TEST_FLOW; //control_symboldemap.CExec.status=TEST_PROCESS; ctrl_symboldemap->CExec.status=ACTIVE; ctrl_symboldemap->CExec.timeslot=*timeSLOT; ctrl_symboldemap->CData.modulation=WIMAXctrl->modulation; if(ctrl_symboldemap->CExec.status==ACTIVE){ ctrl_symboldemap->CData.ninputdata=*numdatainout; ctrl_symboldemap->CData.noutputdata=\ ctrl_symboldemap->CData.ninputdata*\ ctrl_symboldemap->CData.modulation; } if(ctrl_symboldemap->CExec.status==TEST_FLOW){ } if(ctrl_symboldemap->CExec.status==TEST_PROCESS){ } // printf("WIMAX_TXC: SYMBOLDEMAP: TSLOT%d, STATUS=%d, numINDATA=%d, numOUTDATA=%d\n",\ // ctrl_symboldemap->CExec.timeslot,\ // ctrl_symboldemap->CExec.status,\ // ctrl_symboldemap->CData.ninputdata,\ // ctrl_symboldemap->CData.noutputdata); *numdatainout=ctrl_symboldemap->CData.noutputdata; (*chainPosition)++; onlyone=1; } } //////////////////////////////////////////////////////////////////////////////// void control_Deinterleaving(int *chainPosition,int *timeSLOT,int *numdatainout,\ CDeInter *ctrl_deinter, CWimax *WIMAXctrl) { static int onlyone=0; if((*timeSLOT==*chainPosition) && (onlyone==0)){ //control_deinter.CExec.status=TEST_FLOW; //control_deinter.CExec.status=TEST_PROCESS; ctrl_deinter->CExec.status=ACTIVE; ctrl_deinter->CExec.timeslot=*timeSLOT; ctrl_deinter->CData.modulation=WIMAXctrl->modulation; if(ctrl_deinter->CExec.status==ACTIVE){ ctrl_deinter->CData.ninputdata=*numdatainout; ctrl_deinter->CData.noutputdata=ctrl_deinter->CData.ninputdata; } if(ctrl_deinter->CExec.status==TEST_FLOW){ ctrl_deinter->CData.ninputdata=*numdatainout; ctrl_deinter->CData.noutputdata=\ ctrl_deinter->CData.ninputdata; } if(ctrl_deinter->CExec.status==TEST_PROCESS){ ctrl_deinter->CData.ninputdata=1152; ctrl_deinter->CData.noutputdata=0; ctrl_deinter->CData.modulation=_64QAM; } // printf("WIMAX_TXC: DEINTER: TSLOT%d, STATUS=%d, numINDATA=%d, numOUTDATA=%d\n",\ // ctrl_deinter->CExec.timeslot,\ // ctrl_deinter->CExec.status,\ // ctrl_deinter->CData.ninputdata,\ // ctrl_deinter->CData.noutputdata); *numdatainout=ctrl_deinter->CData.noutputdata; (*chainPosition)++; onlyone=1; } } //////////////////////////////////////////////////////////////////////////////// void control_DePuncturing(int *chainPosition,int *timeSLOT,int *numdatainout,\ CDepunc_h *ctrl_depuncturing, CWimax *WIMAXctrl) { static int onlyone=0, numZeros=0; int i; if((*timeSLOT==*chainPosition) && (onlyone==0)){ //control_depuncturing[0].CExec.status=TEST_FLOW; ctrl_depuncturing->status=ACTIVE; ctrl_depuncturing->time_slot=*timeSLOT; ctrl_depuncturing->inputdatalength=*numdatainout; ctrl_depuncturing->punct_rate=WIMAXctrl->punct_rate; ctrl_depuncturing->pseqlength=WIMAXctrl->pseqlength; for(i=0; ipseqlength; i++){ ctrl_depuncturing->punctseq[i]=\ WIMAXctrl->puncseq[i]; if(WIMAXctrl->puncseq[i]==0)numZeros++; } ctrl_depuncturing->numZEROS=numZeros; ctrl_depuncturing->punct_rate=\ (float)ctrl_depuncturing->pseqlength/\ (float)(ctrl_depuncturing->pseqlength-\ ctrl_depuncturing->numZEROS); if(ctrl_depuncturing->status==ACTIVE){ ctrl_depuncturing->outputdatalength=\ (ctrl_depuncturing->inputdatalength*\ ctrl_depuncturing->pseqlength)/\ (ctrl_depuncturing->pseqlength-\ ctrl_depuncturing->numZEROS); } if(ctrl_depuncturing->status==TEST_FLOW){ ctrl_depuncturing->outputdatalength=\ ctrl_depuncturing->inputdatalength; } if(ctrl_depuncturing->status==TEST_PROCESS){ ctrl_depuncturing->outputdatalength=0; } // printf("WIMAX_TXC: DEPUNCT: TSLOT%d, STATUS=%d, numINDATA=%d, numOUTDATA=%d\n",\ // ctrl_depuncturing->time_slot,\ // ctrl_depuncturing->status,\ // ctrl_depuncturing->inputdatalength,\ // ctrl_depuncturing->outputdatalength); // printf("WIMAX_TXC: DEPUNCT: RATE%f, PSEQLENGTH=%d, NUMZEROS=%d\n",\ // ctrl_depuncturing->punct_rate,\ // ctrl_depuncturing->pseqlength,\ // ctrl_depuncturing->numZEROS); *numdatainout=ctrl_depuncturing->outputdatalength; (*chainPosition)++; onlyone=1; } } //////////////////////////////////////////////////////////////////////////////// void control_genViterbi(int *chainPosition,int *timeSLOT,int *numdatainout,\ struct viterbi_h *ctrl_viterbi, CWimax *WIMAXctrl) { static int onlyone=0; if((*timeSLOT==*chainPosition) && (onlyone==0)){ //control_cconv[0].CExec.status=TEST_FLOW; //K=7 if(WIMAXctrl->viterbiK==7){ ctrl_viterbi->CCcoderate=2; ctrl_viterbi->K=7; ctrl_viterbi->long_block=*numdatainout/ctrl_viterbi->CCcoderate\ -ctrl_viterbi->K-1; ctrl_viterbi->num_blocks=1; ctrl_viterbi->EbNo=50.0; ctrl_viterbi->poly[0]=0x79; ctrl_viterbi->poly[1]=0x5B; *numdatainout=(ctrl_viterbi->long_block/BITSPERCHAR); } //K=9 if(WIMAXctrl->viterbiK==9){ ctrl_viterbi->CCcoderate=2; ctrl_viterbi->K=9; ctrl_viterbi->long_block=*numdatainout/ctrl_viterbi->CCcoderate\ -ctrl_viterbi->K+1; ctrl_viterbi->num_blocks=1; ctrl_viterbi->EbNo=50.0; ctrl_viterbi->poly[0]=0x1AF; ctrl_viterbi->poly[1]=0x11D; *numdatainout=ctrl_viterbi->long_block/BITSPERCHAR; } // printf("WIMAX_TXC: VITERBI: CODERATE%d, K=%d, long_block=%d, num_blocks=%d\n",\ // ctrl_viterbi->CCcoderate,\ // ctrl_viterbi->K,\ // ctrl_viterbi->long_block,\ // ctrl_viterbi->num_blocks); (*chainPosition)++; onlyone=1; } } //////////////////////////////////////////////////////////////////////////////// void control_DeRSolomon(int *chainPosition,int *timeSLOT,int *numdatainout,\ CDersolomon *ctrl_dersolomon, CWimax *WIMAXctrl) { static int onlyone=0; int i; if((*timeSLOT==*chainPosition) && (onlyone==0)){ //control_dersolomon[0].CExec.status=TEST_FLOW; ctrl_dersolomon->CExec.status=ACTIVE; ctrl_dersolomon->CExec.timeslot=*timeSLOT; ctrl_dersolomon->CData.ninputbytes=*numdatainout; ctrl_dersolomon->CData.noutputbytes=WIMAXctrl->uncodedbytes; ctrl_dersolomon->CData.modulation=WIMAXctrl->modulation; ctrl_dersolomon->CData.rsolomon_Pbytes=WIMAXctrl->rsolomon; // printf("WIMAX_TXC: DERSOL: TSLOT%d, STATUS=%d, numINDATA=%d, numOUTDATA=%d\n",\ // ctrl_dersolomon->CExec.timeslot,\ // ctrl_dersolomon->CExec.status,\ // ctrl_dersolomon->CData.ninputbytes,\ // ctrl_dersolomon->CData.noutputbytes); *numdatainout=ctrl_dersolomon->CData.noutputbytes; (*chainPosition)++; onlyone=1; } } //////////////////////////////////////////////////////////////////////////////// void control_DeRando(int *chainPosition,int *timeSLOT,int *numdatainout,\ CDerando *ctrl_derando, CWimax *WIMAXctrl) { static int onlyone=0; if((*timeSLOT==*chainPosition) && (onlyone==0)){ ctrl_derando->CExec.status=ACTIVE; ctrl_derando->CExec.timeslot=*timeSLOT; ctrl_derando->CData.ninputbytes=*numdatainout; ctrl_derando->CData.noutputbytes=\ ctrl_derando->CData.ninputbytes; // printf("WIMAX_TXC: DERANDO: TSLOT%d, STATUS=%d, numINDATA=%d, numOUTDATA=%d\n",\ // ctrl_derando->CExec.timeslot,\ // ctrl_derando->CExec.status,\ // ctrl_derando->CData.ninputbytes,\ // ctrl_derando->CData.noutputbytes); *numdatainout=ctrl_derando->CData.noutputbytes; (*chainPosition)++; onlyone=1; } } //////////////////////////////////////////////////////////////////////////////// void control_DataSink(int *chainPosition,int *timeSLOT,int *numdatainout,\ CDataSink *ctrl_datasink, CWimax *WIMAXctrl) { static int onlyone=0; int i; if((*timeSLOT==*chainPosition) && (onlyone==0)){ ctrl_datasink->CExec.status=ACTIVE; ctrl_datasink->CExec.timeslot=*timeSLOT; ctrl_datasink->CData.numdatabytes=*numdatainout; // printf("WIMAX_TXC: DATASINK: TSLOT%d, STATUS=%d, numINDATA=%d\n",\ // ctrl_datasink->CExec.timeslot,\ // ctrl_datasink->CExec.status,\ // ctrl_datasink->CData.numdatabytes); *numdatainout=ctrl_datasink->CData.numdatabytes; (*chainPosition)++; onlyone=1; } } ////////////////////////////////////////////////////////////////////////////////