Converting OFDM mod/de-mod functions to use c16_ts instead of int16_ts
This commit is contained in:
@@ -51,7 +51,7 @@ void PHY_ofdm_mod(int *input,
|
||||
void normal_prefix_mod(int32_t *txdataF,int32_t *txdata,uint8_t nsymb,LTE_DL_FRAME_PARMS *frame_parms);
|
||||
void nr_normal_prefix_mod(c16_t *txdataF, c16_t *txdata, uint8_t nsymb, NR_DL_FRAME_PARMS *frame_parms, uint32_t slot);
|
||||
|
||||
void do_OFDM_mod(int32_t **txdataF, int32_t **txdata, uint32_t frame,uint16_t next_slot, LTE_DL_FRAME_PARMS *frame_parms);
|
||||
void do_OFDM_mod(c16_t **txdataF, c16_t **txdata, uint32_t frame,uint16_t next_slot, LTE_DL_FRAME_PARMS *frame_parms);
|
||||
|
||||
|
||||
/** @}*/
|
||||
|
||||
@@ -45,16 +45,16 @@ void normal_prefix_mod(int32_t *txdataF,int32_t *txdata,uint8_t nsymb,LTE_DL_FRA
|
||||
|
||||
|
||||
|
||||
PHY_ofdm_mod(txdataF, // input
|
||||
txdata, // output
|
||||
frame_parms->ofdm_symbol_size,
|
||||
PHY_ofdm_mod((int *)txdataF, // input
|
||||
(int *)txdata, // output
|
||||
frame_parms->ofdm_symbol_size,
|
||||
|
||||
1, // number of symbols
|
||||
frame_parms->nb_prefix_samples0, // number of prefix samples
|
||||
CYCLIC_PREFIX);
|
||||
PHY_ofdm_mod(txdataF+frame_parms->ofdm_symbol_size, // input
|
||||
txdata+OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES0, // output
|
||||
frame_parms->ofdm_symbol_size,
|
||||
PHY_ofdm_mod((int *)txdataF+frame_parms->ofdm_symbol_size, // input
|
||||
(int *)txdata+OFDM_SYMBOL_SIZE_COMPLEX_SAMPLES0, // output
|
||||
frame_parms->ofdm_symbol_size,
|
||||
nsymb-1,
|
||||
frame_parms->nb_prefix_samples, // number of prefix samples
|
||||
CYCLIC_PREFIX);
|
||||
@@ -280,7 +280,7 @@ void PHY_ofdm_mod(int *input, /// pointer to complex input
|
||||
}
|
||||
|
||||
|
||||
void do_OFDM_mod(int32_t **txdataF, int32_t **txdata, uint32_t frame,uint16_t next_slot, LTE_DL_FRAME_PARMS *frame_parms)
|
||||
void do_OFDM_mod(c16_t **txdataF, c16_t **txdata, uint32_t frame,uint16_t next_slot, LTE_DL_FRAME_PARMS *frame_parms)
|
||||
{
|
||||
|
||||
int aa, slot_offset, slot_offset_F;
|
||||
@@ -292,39 +292,39 @@ void do_OFDM_mod(int32_t **txdataF, int32_t **txdata, uint32_t frame,uint16_t ne
|
||||
if (is_pmch_subframe(frame,next_slot>>1,frame_parms)) {
|
||||
if ((next_slot%2)==0) {
|
||||
LOG_D(PHY,"Frame %d, subframe %d: Doing MBSFN modulation (slot_offset %d)\n",frame,next_slot>>1,slot_offset);
|
||||
PHY_ofdm_mod(&txdataF[aa][slot_offset_F], // input
|
||||
&txdata[aa][slot_offset], // output
|
||||
PHY_ofdm_mod((int *)&txdataF[aa][slot_offset_F], // input
|
||||
(int *)&txdata[aa][slot_offset], // output
|
||||
frame_parms->ofdm_symbol_size,
|
||||
12, // number of symbols
|
||||
frame_parms->ofdm_symbol_size>>2, // number of prefix samples
|
||||
CYCLIC_PREFIX);
|
||||
|
||||
if (frame_parms->Ncp == EXTENDED)
|
||||
PHY_ofdm_mod(&txdataF[aa][slot_offset_F], // input
|
||||
&txdata[aa][slot_offset], // output
|
||||
PHY_ofdm_mod((int *)&txdataF[aa][slot_offset_F], // input
|
||||
(int *)&txdata[aa][slot_offset], // output
|
||||
frame_parms->ofdm_symbol_size,
|
||||
2, // number of symbols
|
||||
frame_parms->nb_prefix_samples, // number of prefix samples
|
||||
CYCLIC_PREFIX);
|
||||
else {
|
||||
LOG_D(PHY,"Frame %d, subframe %d: Doing PDCCH modulation\n",frame,next_slot>>1);
|
||||
normal_prefix_mod(&txdataF[aa][slot_offset_F],
|
||||
&txdata[aa][slot_offset],
|
||||
normal_prefix_mod((int32_t *)&txdataF[aa][slot_offset_F],
|
||||
(int32_t *)&txdata[aa][slot_offset],
|
||||
2,
|
||||
frame_parms);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (frame_parms->Ncp == EXTENDED)
|
||||
PHY_ofdm_mod(&txdataF[aa][slot_offset_F], // input
|
||||
&txdata[aa][slot_offset], // output
|
||||
PHY_ofdm_mod((int *)&txdataF[aa][slot_offset_F], // input
|
||||
(int *)&txdata[aa][slot_offset], // output
|
||||
frame_parms->ofdm_symbol_size,
|
||||
6, // number of symbols
|
||||
frame_parms->nb_prefix_samples, // number of prefix samples
|
||||
CYCLIC_PREFIX);
|
||||
else {
|
||||
normal_prefix_mod(&txdataF[aa][slot_offset_F],
|
||||
&txdata[aa][slot_offset],
|
||||
normal_prefix_mod((int32_t *)&txdataF[aa][slot_offset_F],
|
||||
(int32_t *)&txdata[aa][slot_offset],
|
||||
7,
|
||||
frame_parms);
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ int main(int argc, char **argv)
|
||||
double sigma2, sigma2_dB=10,SNR,snr0=-2.0,snr1=2.0;
|
||||
double cfo=0;
|
||||
uint8_t snr1set=0;
|
||||
int **txdata;
|
||||
c16_t **txdata;
|
||||
double **s_re,**s_im,**r_re,**r_im;
|
||||
//double iqim = 0.0;
|
||||
double ip =0.0;
|
||||
@@ -586,7 +586,7 @@ int main(int argc, char **argv)
|
||||
s_im = malloc(2*sizeof(double*));
|
||||
r_re = malloc(2*sizeof(double*));
|
||||
r_im = malloc(2*sizeof(double*));
|
||||
txdata = calloc(2,sizeof(int*));
|
||||
txdata = calloc(2, sizeof(c16_t*));
|
||||
|
||||
for (i=0; i<2; i++) {
|
||||
|
||||
@@ -596,7 +596,7 @@ int main(int argc, char **argv)
|
||||
r_re[i] = malloc16_clear(frame_length_complex_samples*sizeof(double));
|
||||
r_im[i] = malloc16_clear(frame_length_complex_samples*sizeof(double));
|
||||
printf("Allocating %d samples for txdata\n",frame_length_complex_samples);
|
||||
txdata[i] = malloc16_clear(frame_length_complex_samples*sizeof(int));
|
||||
txdata[i] = malloc16_clear(frame_length_complex_samples * sizeof(c16_t));
|
||||
}
|
||||
|
||||
if (pbch_file_fd!=NULL) {
|
||||
@@ -655,7 +655,7 @@ int main(int argc, char **argv)
|
||||
12);
|
||||
|
||||
PHY_ofdm_mod((int *)gNB->common_vars.txdataF[aa],
|
||||
&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)],
|
||||
(int *)&txdata[aa][frame_parms->get_samples_slot_timestamp(slot,frame_parms,0)],
|
||||
frame_parms->ofdm_symbol_size,
|
||||
12,
|
||||
frame_parms->nb_prefix_samples,
|
||||
@@ -726,8 +726,8 @@ int main(int argc, char **argv)
|
||||
|
||||
for (i=0; i<frame_length_complex_samples; i++) {
|
||||
for (aa=0; aa<frame_parms->nb_antennas_tx; aa++) {
|
||||
r_re[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)]);
|
||||
r_im[aa][i] = ((double)(((short *)txdata[aa]))[(i<<1)+1]);
|
||||
r_re[aa][i] = (double)txdata[aa][i].r;
|
||||
r_im[aa][i] = (double)txdata[aa][i].i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -761,8 +761,8 @@ int main(int argc, char **argv)
|
||||
|
||||
for (i=0; i<frame_length_complex_samples; i++) {
|
||||
for (aa=0; aa<frame_parms->nb_antennas_rx; aa++) {
|
||||
((short*) UE->common_vars.rxdata[aa])[2*i] = (short) ((r_re[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
((short*) UE->common_vars.rxdata[aa])[2*i+1] = (short) ((r_im[aa][i] + sqrt(sigma2/2)*gaussdouble(0.0,1.0)));
|
||||
UE->common_vars.rxdata[aa][i].r = (short)(r_re[aa][i] + sqrt(sigma2 / 2) * gaussdouble(0.0, 1.0));
|
||||
UE->common_vars.rxdata[aa][i].i = (short)(r_im[aa][i] + sqrt(sigma2 / 2) * gaussdouble(0.0, 1.0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user