changed malloc to calloc to avoid random initialization of parameters
git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5240 818b1a75-f10b-46b9-bf7c-635c3b92a50f
This commit is contained in:
+2
-2
@@ -87,7 +87,7 @@ void mexFunction( int nlhs, mxArray *plhs[],
|
||||
}
|
||||
|
||||
// Create a LTE_DL_FRAME_PARMS structure and assign required params
|
||||
frame_parms = malloc(sizeof(LTE_DL_FRAME_PARMS));
|
||||
frame_parms = calloc(1,sizeof(LTE_DL_FRAME_PARMS));
|
||||
tmp = mxGetField(prhs[3],0,"nb_rb");
|
||||
if (tmp == NULL) {
|
||||
mexErrMsgTxt("Non-existing field 'nb_rb' in input argument 4.");
|
||||
@@ -120,7 +120,7 @@ void mexFunction( int nlhs, mxArray *plhs[],
|
||||
}
|
||||
|
||||
// Create PHY_MEASUREMENTS structure and assign required params
|
||||
phy_measurements = malloc(sizeof(PHY_MEASUREMENTS));
|
||||
phy_measurements = calloc(1,sizeof(PHY_MEASUREMENTS));
|
||||
phy_measurements->n0_power[0] = 1; // dummy values
|
||||
phy_measurements->n0_power[1] = 1;
|
||||
phy_measurements->n0_power_tot = 1;
|
||||
|
||||
+1
-1
@@ -44,7 +44,7 @@ void mexFunction( int nlhs, mxArray *plhs[],
|
||||
pmi_ext = (unsigned char*) mxGetData(prhs[1]);
|
||||
|
||||
// Create a LTE_DL_FRAME_PARMS structure and assign required params
|
||||
frame_parms = malloc(sizeof(LTE_DL_FRAME_PARMS));
|
||||
frame_parms = calloc(1,sizeof(LTE_DL_FRAME_PARMS));
|
||||
tmp = mxGetField(prhs[2],0,"nb_rb");
|
||||
if (tmp == NULL) {
|
||||
mexErrMsgTxt("Non-existing field 'nb_rb' in input argument 3.");
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
*
|
||||
===============================================================================*/
|
||||
|
||||
// #define DEBUG_DLSCH_DECODING
|
||||
//#define DEBUG_DLSCH_DECODING
|
||||
|
||||
void mexFunction( int mlhs, mxArray *plhs[],
|
||||
int nrhs, const mxArray *prhs[]
|
||||
@@ -85,7 +85,7 @@ void mexFunction( int mlhs, mxArray *plhs[],
|
||||
dlsch->current_harq_pid = harq_pid;
|
||||
dlsch->harq_processes[harq_pid]->rvidx = (unsigned char) mxGetScalar(mxGetField(prhs[2],0,"rvidx"));
|
||||
dlsch->harq_processes[harq_pid]->Nl = (unsigned char) mxGetScalar(mxGetField(prhs[2],0,"Nl"));
|
||||
dlsch->harq_processes[harq_pid]->Ndi = (unsigned char) mxGetScalar(mxGetField(prhs[2],0,"Ndi"));
|
||||
//dlsch->harq_processes[harq_pid]->Ndi = (unsigned char) mxGetScalar(mxGetField(prhs[2],0,"Ndi"));
|
||||
dlsch->harq_processes[harq_pid]->mcs = mcs;
|
||||
dlsch->harq_processes[harq_pid]->rb_alloc[0] = (unsigned int) mxGetScalar(mxGetField(prhs[1],0,"rb_alloc"));
|
||||
dlsch->harq_processes[harq_pid]->nb_rb = (unsigned short) mxGetScalar(mxGetField(prhs[1],0,"nb_rb"));
|
||||
@@ -96,10 +96,10 @@ void mexFunction( int mlhs, mxArray *plhs[],
|
||||
num_pdcch_symbols = (unsigned char) mxGetScalar(mxGetField(prhs[1],0,"num_pdcch_symbols"));
|
||||
subframe = (unsigned char) mxGetScalar(mxGetField(prhs[1],0,"subframe"));
|
||||
|
||||
phy_vars_ue = malloc16(sizeof(PHY_VARS_UE));
|
||||
phy_vars_ue = calloc(1,sizeof(PHY_VARS_UE));
|
||||
|
||||
// Create a LTE_DL_FRAME_PARMS structure and assign required params
|
||||
frame_parms = malloc16(sizeof(LTE_DL_FRAME_PARMS));
|
||||
frame_parms = calloc(1,sizeof(LTE_DL_FRAME_PARMS));
|
||||
frame_parms->N_RB_DL = (unsigned char) mxGetScalar(mxGetField(prhs[1],0,"nb_rb"));
|
||||
frame_parms->frame_type = (unsigned char) mxGetScalar(mxGetField(prhs[1],0,"frame_type"));
|
||||
frame_parms->mode1_flag = (unsigned char) mxGetScalar(mxGetField(prhs[1],0,"mode1_flag"));
|
||||
@@ -108,7 +108,16 @@ void mexFunction( int mlhs, mxArray *plhs[],
|
||||
|
||||
mod_order = get_Qm(dlsch->harq_processes[harq_pid]->mcs);
|
||||
dlsch->harq_processes[harq_pid]->G = get_G(frame_parms,dlsch->harq_processes[harq_pid]->nb_rb,dlsch->harq_processes[harq_pid]->rb_alloc,mod_order,num_pdcch_symbols,0,subframe);
|
||||
|
||||
|
||||
#ifdef DEBUG_DLSCH_DECODING
|
||||
mexPrintf("TBS %d\n",dlsch->harq_processes[harq_pid]->TBS);
|
||||
mexPrintf("nb_rb %d\n",dlsch->harq_processes[harq_pid]->nb_rb);
|
||||
mexPrintf("ncs %d\n",dlsch->harq_processes[harq_pid]->mcs);
|
||||
mexPrintf("num_pdcch_symbols %d\n",num_pdcch_symbols);
|
||||
mexPrintf("subframe %d\n",subframe);
|
||||
mexPrintf("G %d\n",dlsch->harq_processes[harq_pid]->G);
|
||||
#endif
|
||||
|
||||
if (dlsch->harq_processes[harq_pid]->G != mxGetM(prhs[0])) {
|
||||
free_ue_dlsch(dlsch);
|
||||
free(frame_parms);
|
||||
|
||||
@@ -80,7 +80,7 @@ void mexFunction( int nlhs, mxArray *plhs[],
|
||||
}
|
||||
|
||||
// Create a LTE_DL_FRAME_PARMS structure and assign required params
|
||||
frame_parms = malloc(sizeof(LTE_DL_FRAME_PARMS));
|
||||
frame_parms = calloc(1,sizeof(LTE_DL_FRAME_PARMS));
|
||||
|
||||
tmp = mxGetField(prhs[7],0,"nb_rb");
|
||||
if (tmp == NULL) {
|
||||
|
||||
+1
-1
@@ -56,7 +56,7 @@ void mexFunction( int nlhs, mxArray *plhs[],
|
||||
}
|
||||
|
||||
// Create a LTE_DL_FRAME_PARMS structure and assign required params
|
||||
frame_parms = malloc(sizeof(LTE_DL_FRAME_PARMS));
|
||||
frame_parms = calloc(1,sizeof(LTE_DL_FRAME_PARMS));
|
||||
tmp = mxGetField(prhs[2],0,"nb_rb");
|
||||
if (tmp == NULL) {
|
||||
mexErrMsgTxt("Non-existing field 'nb_rb' in input argument 3.");
|
||||
|
||||
@@ -105,12 +105,14 @@ void mexFunction( int nlhs, mxArray *plhs[],
|
||||
} else {
|
||||
dlsch->harq_processes[harq_pid]->Nl = (unsigned char) mxGetScalar(tmp);
|
||||
}
|
||||
/*
|
||||
tmp = mxGetField(prhs[2],0,"Ndi");
|
||||
if (tmp == NULL) {
|
||||
mexErrMsgTxt("Non-existing field 'Ndi' in input argument 3.");
|
||||
} else {
|
||||
dlsch->harq_processes[harq_pid]->Ndi = (unsigned char) mxGetScalar(tmp);
|
||||
}
|
||||
*/
|
||||
tmp = mxGetField(prhs[1],0,"rb_alloc");
|
||||
if (tmp == NULL) {
|
||||
mexErrMsgTxt("Non-existing field 'rb_alloc' in input argument 2.");
|
||||
@@ -146,7 +148,7 @@ void mexFunction( int nlhs, mxArray *plhs[],
|
||||
}
|
||||
|
||||
// Create a LTE_DL_FRAME_PARMS structure and assign required params
|
||||
frame_parms = malloc(sizeof(LTE_DL_FRAME_PARMS));
|
||||
frame_parms = calloc(1,sizeof(LTE_DL_FRAME_PARMS));
|
||||
frame_parms->N_RB_DL = (unsigned char) dlsch->nb_rb;
|
||||
|
||||
tmp = mxGetField(prhs[1],0,"frame_type");
|
||||
|
||||
Reference in New Issue
Block a user