astyle --recursive --indent=spaces=2 --style=kr --indent-col1-comments --break-blocks --convert-tabs --max-code-length=200
This is done for better merging branch/LG_PRE_RELEASE_0.3 into trunk (same process is applied on this branch) git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7073 818b1a75-f10b-46b9-bf7c-635c3b92a50f
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
OpenAirInterface
|
||||
OpenAirInterface
|
||||
Copyright(c) 1999 - 2014 Eurecom
|
||||
|
||||
OpenAirInterface is free software: you can redistribute it and/or modify
|
||||
@@ -14,40 +14,43 @@
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenAirInterface.The full GNU General Public License is
|
||||
included in this distribution in the file called "COPYING". If not,
|
||||
along with OpenAirInterface.The full GNU General Public License is
|
||||
included in this distribution in the file called "COPYING". If not,
|
||||
see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Contact Information
|
||||
OpenAirInterface Admin: openair_admin@eurecom.fr
|
||||
OpenAirInterface Tech : openair_tech@eurecom.fr
|
||||
OpenAirInterface Dev : openair4g-devel@eurecom.fr
|
||||
|
||||
|
||||
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
|
||||
|
||||
*******************************************************************************/
|
||||
void adc(double **r_re,
|
||||
double **r_im,
|
||||
unsigned int input_offset,
|
||||
unsigned int output_offset,
|
||||
unsigned int **output,
|
||||
unsigned int nb_rx_antennas,
|
||||
unsigned int length,
|
||||
unsigned char B) {
|
||||
double **r_im,
|
||||
unsigned int input_offset,
|
||||
unsigned int output_offset,
|
||||
unsigned int **output,
|
||||
unsigned int nb_rx_antennas,
|
||||
unsigned int length,
|
||||
unsigned char B)
|
||||
{
|
||||
|
||||
int i;
|
||||
int aa;
|
||||
double gain = (double)(1<<(B-1));
|
||||
//double gain = 1.0;
|
||||
|
||||
for (i=0;i<length;i++) {
|
||||
for (aa=0;aa<nb_rx_antennas;aa++) {
|
||||
for (i=0; i<length; i++) {
|
||||
for (aa=0; aa<nb_rx_antennas; aa++) {
|
||||
((short *)output[aa])[((i+output_offset)<<1)] = (short)(r_re[aa][i+input_offset]*gain);
|
||||
((short *)output[aa])[1+((i+output_offset)<<1)] = (short)(r_im[aa][i+input_offset]*gain);
|
||||
|
||||
if ((r_re[aa][i+input_offset]*gain) > 30000) {
|
||||
//("Adc outputs %d %e %d \n",i,((short *)output[0])[((i+output_offset)<<1)], ((i+output_offset)<<1) );
|
||||
//("Adc outputs %d %e %d \n",i,((short *)output[0])[((i+output_offset)<<1)], ((i+output_offset)<<1) );
|
||||
}
|
||||
}
|
||||
|
||||
//printf("Adc outputs %d %e %d \n",i,((short *)output[0])[((i+output_offset)<<1)], ((i+output_offset)<<1) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
OpenAirInterface
|
||||
OpenAirInterface
|
||||
Copyright(c) 1999 - 2014 Eurecom
|
||||
|
||||
OpenAirInterface is free software: you can redistribute it and/or modify
|
||||
@@ -14,15 +14,15 @@
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenAirInterface.The full GNU General Public License is
|
||||
included in this distribution in the file called "COPYING". If not,
|
||||
along with OpenAirInterface.The full GNU General Public License is
|
||||
included in this distribution in the file called "COPYING". If not,
|
||||
see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Contact Information
|
||||
OpenAirInterface Admin: openair_admin@eurecom.fr
|
||||
OpenAirInterface Tech : openair_tech@eurecom.fr
|
||||
OpenAirInterface Dev : openair4g-devel@eurecom.fr
|
||||
|
||||
|
||||
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
|
||||
|
||||
*******************************************************************************/
|
||||
@@ -32,37 +32,40 @@
|
||||
#include "PHY/TOOLS/defs.h"
|
||||
|
||||
void dac(double **s_re,
|
||||
double **s_im,
|
||||
uint32_t **input,
|
||||
uint32_t input_offset,
|
||||
uint32_t nb_tx_antennas,
|
||||
uint32_t length,
|
||||
double amp_dBm,
|
||||
uint8_t B,
|
||||
uint32_t meas_length,
|
||||
uint32_t meas_offset) {
|
||||
double **s_im,
|
||||
uint32_t **input,
|
||||
uint32_t input_offset,
|
||||
uint32_t nb_tx_antennas,
|
||||
uint32_t length,
|
||||
double amp_dBm,
|
||||
uint8_t B,
|
||||
uint32_t meas_length,
|
||||
uint32_t meas_offset)
|
||||
{
|
||||
|
||||
int i;
|
||||
int aa;
|
||||
double V=0.0,amp;
|
||||
|
||||
for (i=0;i<length;i++) {
|
||||
for (aa=0;aa<nb_tx_antennas;aa++) {
|
||||
for (i=0; i<length; i++) {
|
||||
for (aa=0; aa<nb_tx_antennas; aa++) {
|
||||
s_re[aa][i] = ((double)(((short *)input[aa]))[((i+input_offset)<<1)])/(1<<(B-1));
|
||||
s_im[aa][i] = ((double)(((short *)input[aa]))[((i+input_offset)<<1)+1])/(1<<(B-1));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
for (i=meas_offset;i<meas_offset+meas_length;i++) {
|
||||
for (aa=0;aa<nb_tx_antennas;aa++) {
|
||||
V= V + (s_re[aa][i]*s_re[aa][i]) + (s_im[aa][i]*s_im[aa][i]);
|
||||
for (i=meas_offset; i<meas_offset+meas_length; i++) {
|
||||
for (aa=0; aa<nb_tx_antennas; aa++) {
|
||||
V= V + (s_re[aa][i]*s_re[aa][i]) + (s_im[aa][i]*s_im[aa][i]);
|
||||
}
|
||||
}
|
||||
|
||||
V /= (meas_length);
|
||||
#ifdef DEBUG_DAC
|
||||
printf("DAC: 10*log10(V)=%f (%f)\n",10*log10(V),V);
|
||||
#endif
|
||||
|
||||
if (V) {
|
||||
amp = pow(10.0,.1*amp_dBm)/V;
|
||||
amp = sqrt(amp);
|
||||
@@ -70,8 +73,8 @@ void dac(double **s_re,
|
||||
amp = 1;
|
||||
}
|
||||
|
||||
for (i=0;i<length;i++) {
|
||||
for (aa=0;aa<nb_tx_antennas;aa++) {
|
||||
for (i=0; i<length; i++) {
|
||||
for (aa=0; aa<nb_tx_antennas; aa++) {
|
||||
s_re[aa][i] *= amp;
|
||||
s_im[aa][i] *= amp;
|
||||
}
|
||||
@@ -79,27 +82,30 @@ void dac(double **s_re,
|
||||
}
|
||||
|
||||
double dac_fixed_gain(double **s_re,
|
||||
double **s_im,
|
||||
uint32_t **input,
|
||||
uint32_t input_offset,
|
||||
uint32_t nb_tx_antennas,
|
||||
uint32_t length,
|
||||
uint32_t input_offset_meas,
|
||||
uint32_t length_meas,
|
||||
uint8_t B,
|
||||
double txpwr_dBm,
|
||||
int NB_RE) {
|
||||
double **s_im,
|
||||
uint32_t **input,
|
||||
uint32_t input_offset,
|
||||
uint32_t nb_tx_antennas,
|
||||
uint32_t length,
|
||||
uint32_t input_offset_meas,
|
||||
uint32_t length_meas,
|
||||
uint8_t B,
|
||||
double txpwr_dBm,
|
||||
int NB_RE)
|
||||
{
|
||||
|
||||
int i;
|
||||
int aa;
|
||||
double amp,amp1;
|
||||
|
||||
|
||||
amp = //sqrt(NB_RE)*pow(10.0,.05*txpwr_dBm)/sqrt(nb_tx_antennas); //this is amp per tx antenna
|
||||
pow(10.0,.05*txpwr_dBm)/sqrt(nb_tx_antennas); //this is amp per tx antenna
|
||||
amp1 = 0;
|
||||
for (aa=0;aa<nb_tx_antennas;aa++) {
|
||||
|
||||
for (aa=0; aa<nb_tx_antennas; aa++) {
|
||||
amp1 += sqrt((double)signal_energy((int32_t*)&input[aa][input_offset_meas],length_meas)/NB_RE);
|
||||
}
|
||||
|
||||
amp1/=nb_tx_antennas;
|
||||
|
||||
// printf("DAC: amp1 %f dB (%d,%d), tx_power %f\n",20*log10(amp1),input_offset,input_offset_meas,txpwr_dBm);
|
||||
@@ -109,14 +115,14 @@ double dac_fixed_gain(double **s_re,
|
||||
amp1 = AMP/2;
|
||||
else if (nb_tx_antennas==4)
|
||||
amp1 = ((AMP*ONE_OVER_SQRT2_Q15)>>16);
|
||||
else //assume (nb_tx_antennas==1)
|
||||
else //assume (nb_tx_antennas==1)
|
||||
amp1 = ((AMP*ONE_OVER_SQRT2_Q15)>>15);
|
||||
amp1 = amp1*sqrt(512.0/300.0); //account for loss due to null carriers
|
||||
//printf("DL: amp1 %f dB (%d,%d), tx_power %f\n",20*log10(amp1),input_offset,input_offset_meas,txpwr_dBm);
|
||||
*/
|
||||
|
||||
for (i=0;i<length;i++) {
|
||||
for (aa=0;aa<nb_tx_antennas;aa++) {
|
||||
|
||||
for (i=0; i<length; i++) {
|
||||
for (aa=0; aa<nb_tx_antennas; aa++) {
|
||||
s_re[aa][i] = amp*((double)(((short *)input[aa]))[((i+input_offset)<<1)])/amp1; ///(1<<(B-1));
|
||||
s_im[aa][i] = amp*((double)(((short *)input[aa]))[((i+input_offset)<<1)+1])/amp1; ///(1<<(B-1));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
OpenAirInterface
|
||||
OpenAirInterface
|
||||
Copyright(c) 1999 - 2014 Eurecom
|
||||
|
||||
OpenAirInterface is free software: you can redistribute it and/or modify
|
||||
@@ -14,15 +14,15 @@
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenAirInterface.The full GNU General Public License is
|
||||
included in this distribution in the file called "COPYING". If not,
|
||||
along with OpenAirInterface.The full GNU General Public License is
|
||||
included in this distribution in the file called "COPYING". If not,
|
||||
see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Contact Information
|
||||
OpenAirInterface Admin: openair_admin@eurecom.fr
|
||||
OpenAirInterface Tech : openair_tech@eurecom.fr
|
||||
OpenAirInterface Dev : openair4g-devel@eurecom.fr
|
||||
|
||||
|
||||
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
|
||||
|
||||
*******************************************************************************/
|
||||
@@ -46,60 +46,60 @@
|
||||
@param IQ_imb_dB IQ amplitude imbalance in dB
|
||||
@param IQ_phase IQ phase imbalance in radians*/
|
||||
void rf_rx(double **r_re,
|
||||
double **r_im,
|
||||
double **r_re_i1,
|
||||
double **r_im_i1,
|
||||
double I0_dB,
|
||||
unsigned int nb_rx_antennas,
|
||||
unsigned int length,
|
||||
double s_time,
|
||||
double f_off,
|
||||
double drift,
|
||||
double noise_figure,
|
||||
double rx_gain_dB,
|
||||
int IP3_dBm,
|
||||
double *initial_phase,
|
||||
double pn_cutoff,
|
||||
double pn_amp_dBc,
|
||||
double IQ_imb_dB,
|
||||
double IQ_phase);
|
||||
double **r_im,
|
||||
double **r_re_i1,
|
||||
double **r_im_i1,
|
||||
double I0_dB,
|
||||
unsigned int nb_rx_antennas,
|
||||
unsigned int length,
|
||||
double s_time,
|
||||
double f_off,
|
||||
double drift,
|
||||
double noise_figure,
|
||||
double rx_gain_dB,
|
||||
int IP3_dBm,
|
||||
double *initial_phase,
|
||||
double pn_cutoff,
|
||||
double pn_amp_dBc,
|
||||
double IQ_imb_dB,
|
||||
double IQ_phase);
|
||||
|
||||
void rf_rx_simple(double **r_re,
|
||||
double **r_im,
|
||||
unsigned int nb_rx_antennas,
|
||||
unsigned int length,
|
||||
double s_time,
|
||||
double rx_gain_dB);
|
||||
double **r_im,
|
||||
unsigned int nb_rx_antennas,
|
||||
unsigned int length,
|
||||
double s_time,
|
||||
double rx_gain_dB);
|
||||
|
||||
|
||||
void adc(double **r_re,
|
||||
double **r_im,
|
||||
unsigned int input_offset,
|
||||
unsigned int output_offset,
|
||||
int **output,
|
||||
unsigned int nb_rx_antennas,
|
||||
unsigned int length,
|
||||
unsigned char B);
|
||||
double **r_im,
|
||||
unsigned int input_offset,
|
||||
unsigned int output_offset,
|
||||
int **output,
|
||||
unsigned int nb_rx_antennas,
|
||||
unsigned int length,
|
||||
unsigned char B);
|
||||
|
||||
void dac(double **s_re,
|
||||
double **s_im,
|
||||
int **input,
|
||||
unsigned int input_offset,
|
||||
unsigned int nb_tx_antennas,
|
||||
unsigned int length,
|
||||
double amp_dBm,
|
||||
unsigned char B,
|
||||
unsigned int meas_length,
|
||||
unsigned int meas_offset);
|
||||
double **s_im,
|
||||
int **input,
|
||||
unsigned int input_offset,
|
||||
unsigned int nb_tx_antennas,
|
||||
unsigned int length,
|
||||
double amp_dBm,
|
||||
unsigned char B,
|
||||
unsigned int meas_length,
|
||||
unsigned int meas_offset);
|
||||
|
||||
double dac_fixed_gain(double **s_re,
|
||||
double **s_im,
|
||||
int **input,
|
||||
unsigned int input_offset,
|
||||
unsigned int nb_tx_antennas,
|
||||
unsigned int length,
|
||||
unsigned int input_offset_meas,
|
||||
unsigned int length_meas,
|
||||
unsigned char B,
|
||||
double gain,
|
||||
int NB_RE);
|
||||
double **s_im,
|
||||
int **input,
|
||||
unsigned int input_offset,
|
||||
unsigned int nb_tx_antennas,
|
||||
unsigned int length,
|
||||
unsigned int input_offset_meas,
|
||||
unsigned int length_meas,
|
||||
unsigned char B,
|
||||
double gain,
|
||||
int NB_RE);
|
||||
|
||||
+91
-88
@@ -1,5 +1,5 @@
|
||||
/*******************************************************************************
|
||||
OpenAirInterface
|
||||
OpenAirInterface
|
||||
Copyright(c) 1999 - 2014 Eurecom
|
||||
|
||||
OpenAirInterface is free software: you can redistribute it and/or modify
|
||||
@@ -14,15 +14,15 @@
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenAirInterface.The full GNU General Public License is
|
||||
included in this distribution in the file called "COPYING". If not,
|
||||
along with OpenAirInterface.The full GNU General Public License is
|
||||
included in this distribution in the file called "COPYING". If not,
|
||||
see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Contact Information
|
||||
OpenAirInterface Admin: openair_admin@eurecom.fr
|
||||
OpenAirInterface Tech : openair_tech@eurecom.fr
|
||||
OpenAirInterface Dev : openair4g-devel@eurecom.fr
|
||||
|
||||
|
||||
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
|
||||
|
||||
*******************************************************************************/
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
//#include "PHY/defs.h"
|
||||
#include "SIMULATION/TOOLS/defs.h"
|
||||
|
||||
|
||||
/*
|
||||
extern void randominit(void);
|
||||
extern double gaussdouble(double,double);
|
||||
@@ -48,26 +48,27 @@ extern int write_output(const char *,const char *,void *,int,int,char);
|
||||
|
||||
//#define DEBUG_RF 1
|
||||
|
||||
//free(input_data);
|
||||
//free(input_data);
|
||||
void rf_rx(double **r_re,
|
||||
double **r_im,
|
||||
double **r_re_i1,
|
||||
double **r_im_i1,
|
||||
double I0_dB,
|
||||
unsigned int nb_rx_antennas,
|
||||
unsigned int length,
|
||||
double s_time,
|
||||
double f_off,
|
||||
double drift,
|
||||
double noise_figure,
|
||||
double rx_gain_dB,
|
||||
int IP3_dBm,
|
||||
double *initial_phase,
|
||||
double pn_cutoff,
|
||||
double pn_amp_dBc,
|
||||
double IQ_imb_dB,
|
||||
double IQ_phase) {
|
||||
|
||||
double **r_im,
|
||||
double **r_re_i1,
|
||||
double **r_im_i1,
|
||||
double I0_dB,
|
||||
unsigned int nb_rx_antennas,
|
||||
unsigned int length,
|
||||
double s_time,
|
||||
double f_off,
|
||||
double drift,
|
||||
double noise_figure,
|
||||
double rx_gain_dB,
|
||||
int IP3_dBm,
|
||||
double *initial_phase,
|
||||
double pn_cutoff,
|
||||
double pn_amp_dBc,
|
||||
double IQ_imb_dB,
|
||||
double IQ_phase)
|
||||
{
|
||||
|
||||
double phase = *initial_phase;
|
||||
double phase2 = *initial_phase;
|
||||
double phase_inc = 2*M_PI*f_off*s_time*1e-9;
|
||||
@@ -94,12 +95,12 @@ void rf_rx(double **r_re,
|
||||
int i,a,have_interference=0;
|
||||
|
||||
|
||||
if (pn_amp_dBc > -20.0){
|
||||
if (pn_amp_dBc > -20.0) {
|
||||
printf("rf.c: Illegal pn_amp_dBc %f\n",pn_amp_dBc);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if ((pn_cutoff > 1e6) || (pn_cutoff<1e3)){
|
||||
if ((pn_cutoff > 1e6) || (pn_cutoff<1e3)) {
|
||||
printf("rf.c: Illegal pn_cutoff %f\n",pn_cutoff);
|
||||
exit(-1);
|
||||
}
|
||||
@@ -129,7 +130,7 @@ void rf_rx(double **r_re,
|
||||
#endif
|
||||
|
||||
/*
|
||||
for (i=0;i<nb_rx_antennas;i++)
|
||||
for (i=0;i<nb_rx_antennas;i++)
|
||||
if (noise_figure[i] < 1.0) {
|
||||
printf("rf.c: Illegal noise_figure %d %f\n",i,noise_figure[i]);
|
||||
exit(-1);
|
||||
@@ -149,14 +150,14 @@ void rf_rx(double **r_re,
|
||||
if ((r_re_i1) && (r_im_i1) )
|
||||
have_interference=1;
|
||||
|
||||
for (i=0;i<length;i++) {
|
||||
for (i=0; i<length; i++) {
|
||||
|
||||
|
||||
for (a=0;a<nb_rx_antennas;a++) {
|
||||
|
||||
for (a=0; a<nb_rx_antennas; a++) {
|
||||
|
||||
if (have_interference==1) {
|
||||
r_re[a][i] = r_re[a][i] + (I0 * r_re_i1[a][i]);
|
||||
r_im[a][i] = r_im[a][i] + (I0 * r_im_i1[a][i]);
|
||||
r_re[a][i] = r_re[a][i] + (I0 * r_re_i1[a][i]);
|
||||
r_im[a][i] = r_im[a][i] + (I0 * r_im_i1[a][i]);
|
||||
}
|
||||
|
||||
// Amplify by receiver gain and apply 3rd order non-linearity
|
||||
@@ -200,18 +201,19 @@ void rf_rx(double **r_re,
|
||||
y_n1 = p_noise;
|
||||
y_n2 = y_n1;
|
||||
p_noise = pn_a0*x_n + 2*pn_a0*x_n1 + pn_a0*x_n2 - pn_b1*y_n1 - pn_b2*y_n2;
|
||||
|
||||
|
||||
// pn[i] = p_noise;
|
||||
}
|
||||
}
|
||||
|
||||
void rf_rx_simple(double **r_re,
|
||||
double **r_im,
|
||||
unsigned int nb_rx_antennas,
|
||||
unsigned int length,
|
||||
double s_time,
|
||||
double rx_gain_dB) {
|
||||
|
||||
double **r_im,
|
||||
unsigned int nb_rx_antennas,
|
||||
unsigned int length,
|
||||
double s_time,
|
||||
double rx_gain_dB)
|
||||
{
|
||||
|
||||
int i,a;
|
||||
double rx_gain_lin = pow(10.0,.05*rx_gain_dB);
|
||||
//double rx_gain_lin = 1.0;
|
||||
@@ -226,8 +228,8 @@ void rf_rx_simple(double **r_re,
|
||||
printf("rx_gain = %f dB(%f)\n",rx_gain_dB,rx_gain_lin);
|
||||
#endif
|
||||
|
||||
for (i=0;i<length;i++) {
|
||||
for (a=0;a<nb_rx_antennas;a++) {
|
||||
for (i=0; i<length; i++) {
|
||||
for (a=0; a<nb_rx_antennas; a++) {
|
||||
// Amplify by receiver gain and apply 3rd order non-linearity
|
||||
r_re[a][i] = rx_gain_lin*(r_re[a][i] + sqrt(.5*N0W)*gaussdouble(0.0,1.0));
|
||||
r_im[a][i] = rx_gain_lin*(r_im[a][i] + sqrt(.5*N0W)*gaussdouble(0.0,1.0));
|
||||
@@ -235,15 +237,16 @@ void rf_rx_simple(double **r_re,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef RF_MAIN
|
||||
#define INPUT_dBm -70.0
|
||||
|
||||
int QPSK[4]={AMP_OVER_SQRT2|(AMP_OVER_SQRT2<<16),AMP_OVER_SQRT2|((65536-AMP_OVER_SQRT2)<<16),((65536-AMP_OVER_SQRT2)<<16)|AMP_OVER_SQRT2,((65536-AMP_OVER_SQRT2)<<16)|(65536-AMP_OVER_SQRT2)};
|
||||
int QPSK2[4]={AMP_OVER_2|(AMP_OVER_2<<16),AMP_OVER_2|((65536-AMP_OVER_2)<<16),((65536-AMP_OVER_2)<<16)|AMP_OVER_2,((65536-AMP_OVER_2)<<16)|(65536-AMP_OVER_2)};
|
||||
int QPSK[4]= {AMP_OVER_SQRT2|(AMP_OVER_SQRT2<<16),AMP_OVER_SQRT2|((65536-AMP_OVER_SQRT2)<<16),((65536-AMP_OVER_SQRT2)<<16)|AMP_OVER_SQRT2,((65536-AMP_OVER_SQRT2)<<16)|(65536-AMP_OVER_SQRT2)};
|
||||
int QPSK2[4]= {AMP_OVER_2|(AMP_OVER_2<<16),AMP_OVER_2|((65536-AMP_OVER_2)<<16),((65536-AMP_OVER_2)<<16)|AMP_OVER_2,((65536-AMP_OVER_2)<<16)|(65536-AMP_OVER_2)};
|
||||
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
// Fill input vector with complex sinusoid
|
||||
|
||||
@@ -258,7 +261,7 @@ int main(int argc, char* argv[]) {
|
||||
|
||||
uint32_t **input = malloc(nb_antennas*sizeof(uint32_t*));
|
||||
uint32_t **output = malloc(nb_antennas*sizeof(uint32_t*));
|
||||
|
||||
|
||||
double **s_re = malloc(nb_antennas*sizeof (double *));
|
||||
double **s_im = malloc(nb_antennas*sizeof (double *));
|
||||
double **r_re = malloc(nb_antennas*sizeof (double *));
|
||||
@@ -271,66 +274,66 @@ int main(int argc, char* argv[]) {
|
||||
set_taus_seed(0);
|
||||
|
||||
channel = new_channel_desc_scm(nb_antennas,
|
||||
nb_antennas,
|
||||
AWGN,
|
||||
7.68e6,
|
||||
0,
|
||||
0,
|
||||
path_loss_dB);
|
||||
nb_antennas,
|
||||
AWGN,
|
||||
7.68e6,
|
||||
0,
|
||||
0,
|
||||
path_loss_dB);
|
||||
|
||||
for (i=0;i<nb_antennas;i++) {
|
||||
for (i=0; i<nb_antennas; i++) {
|
||||
s_re[i] = (double *)malloc(length * sizeof (double ));
|
||||
s_im[i] = (double *)malloc(length * sizeof (double ));
|
||||
r_re[i] = (double *)malloc(length * sizeof (double ));
|
||||
r_im[i] = (double *)malloc(length * sizeof (double ));
|
||||
input[i] = (uint32_t*)malloc(length * sizeof(uint32_t));
|
||||
output[i] = (uint32_t*)malloc(length * sizeof(uint32_t));
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0;i<nb_antennas;i++) {
|
||||
for (i=0; i<nb_antennas; i++) {
|
||||
// generate a random QPSK signal
|
||||
for (j=0;j<length/2;j++) {
|
||||
for (j=0; j<length/2; j++) {
|
||||
input[i][j] = QPSK[taus()&3];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
tx_pwr = dac_fixed_gain(s_re,
|
||||
s_im,
|
||||
input,
|
||||
0,
|
||||
nb_antennas,
|
||||
length,
|
||||
0,
|
||||
512,
|
||||
14,
|
||||
15.0);
|
||||
s_im,
|
||||
input,
|
||||
0,
|
||||
nb_antennas,
|
||||
length,
|
||||
0,
|
||||
512,
|
||||
14,
|
||||
15.0);
|
||||
|
||||
multipath_channel(channel,s_re,s_im,r_re,r_im,
|
||||
length,0);
|
||||
|
||||
length,0);
|
||||
|
||||
rf_rx_simple(r_re,
|
||||
r_im,
|
||||
nb_antennas,
|
||||
length,
|
||||
1.0/7.68e6 * 1e9,// sampling time (ns)
|
||||
rx_gain_dB - 66.227);
|
||||
r_im,
|
||||
nb_antennas,
|
||||
length,
|
||||
1.0/7.68e6 * 1e9,// sampling time (ns)
|
||||
rx_gain_dB - 66.227);
|
||||
|
||||
/*
|
||||
rf_rx(r_re,
|
||||
r_im,
|
||||
nb_antennas,
|
||||
length,
|
||||
1.0/6.5e6 * 1e9,// sampling time (ns)
|
||||
1000.0 , //freq offset (Hz)
|
||||
0.0, //drift (Hz) NOT YET IMPLEMENTED
|
||||
nf, //noise_figure NOT YET IMPLEMENTED
|
||||
-INPUT_dBm, //rx_gain (dB)
|
||||
200, // IP3_dBm (dBm)
|
||||
&ip, // initial phase
|
||||
30.0e3, // pn_cutoff (kHz)
|
||||
-500.0, // pn_amp (dBc)
|
||||
-0.0, // IQ imbalance (dB),
|
||||
0.0); // IQ phase imbalance (rad)
|
||||
r_im,
|
||||
nb_antennas,
|
||||
length,
|
||||
1.0/6.5e6 * 1e9,// sampling time (ns)
|
||||
1000.0 , //freq offset (Hz)
|
||||
0.0, //drift (Hz) NOT YET IMPLEMENTED
|
||||
nf, //noise_figure NOT YET IMPLEMENTED
|
||||
-INPUT_dBm, //rx_gain (dB)
|
||||
200, // IP3_dBm (dBm)
|
||||
&ip, // initial phase
|
||||
30.0e3, // pn_cutoff (kHz)
|
||||
-500.0, // pn_amp (dBc)
|
||||
-0.0, // IQ imbalance (dB),
|
||||
0.0); // IQ phase imbalance (rad)
|
||||
*/
|
||||
|
||||
adc(r_re,
|
||||
@@ -341,7 +344,7 @@ int main(int argc, char* argv[]) {
|
||||
nb_antennas,
|
||||
length,
|
||||
12);
|
||||
|
||||
|
||||
write_output("s_im.m","s_im",s_im[0],length,1,7);
|
||||
write_output("s_re.m","s_re",s_re[0],length,1,7);
|
||||
write_output("r_im.m","r_im",r_im[0],length,1,7);
|
||||
|
||||
Reference in New Issue
Block a user