Commit a326f804 authored by 111's avatar 111

add 4ant

parent 54f5383e
...@@ -5,14 +5,16 @@ ...@@ -5,14 +5,16 @@
#include "trx_test.h" #include "trx_test.h"
int txdata_size=57344; #define NB_ANTENNAS_RX 1
int rxdata_size=2465792; #define NB_ANTENNAS_TX 4
#define SAMPLE_RATE (122880000)
int txdata_size=61440*4;
int rxdata_size=61440*4;
int absolute_slot=0; int absolute_slot=0;
int nb_slot_frame=2; int nb_slot_frame=2;
int samples_per_subframe=30720; int samples_per_subframe=SAMPLE_RATE/1000;
int NB_ANTENNAS_RX=4;
int NB_ANTENNAS_TX=4;
//samples_per_subframe 30720, samples_per_slot_wCP 14336. //samples_per_subframe 30720, samples_per_slot_wCP 14336.
//txdata_size 57344, txdataF_size 57344, rxdata_size 2465792. //txdata_size 57344, txdataF_size 57344, rxdata_size 2465792.
...@@ -63,8 +65,8 @@ int main( int argc, char **argv ) { ...@@ -63,8 +65,8 @@ int main( int argc, char **argv ) {
openair0_device rfdevice; openair0_device rfdevice;
int card=0; int card=0;
openair0_cfg[card].sample_rate = 30720 * 1e3; openair0_cfg[card].sample_rate = 30720 * 1e3 * 4;
openair0_cfg[card].samples_per_frame = 30720; openair0_cfg[card].samples_per_frame = 30720 * 4;
openair0_cfg[card].duplex_mode = duplex_mode_TDD; openair0_cfg[card].duplex_mode = duplex_mode_TDD;
...@@ -72,8 +74,8 @@ int main( int argc, char **argv ) { ...@@ -72,8 +74,8 @@ int main( int argc, char **argv ) {
openair0_cfg[card].num_rb_dl = 51; openair0_cfg[card].num_rb_dl = 51;
openair0_cfg[card].clock_source = 0; openair0_cfg[card].clock_source = 0;
openair0_cfg[card].time_source = 0; openair0_cfg[card].time_source = 0;
openair0_cfg[card].tx_num_channels = 1; openair0_cfg[card].tx_num_channels = NB_ANTENNAS_TX;
openair0_cfg[card].rx_num_channels = 1; openair0_cfg[card].rx_num_channels = NB_ANTENNAS_RX;
printf("HW: Configuring card %d, sample_rate %f, tx/rx num_channels %d/%d, duplex_mode %d\n", printf("HW: Configuring card %d, sample_rate %f, tx/rx num_channels %d/%d, duplex_mode %d\n",
card, card,
...@@ -116,7 +118,7 @@ int main( int argc, char **argv ) { ...@@ -116,7 +118,7 @@ int main( int argc, char **argv ) {
openair0_cfg[card].sdr_addrs = "dev=pciex:0,auxdac1=300"; openair0_cfg[card].sdr_addrs = "dev=pciex:0,auxdac1=300";
openair0_timestamp timestamp, writeTimestamp; openair0_timestamp timestamp, timestampold, writeTimestamp;
int32_t * rxp[NB_ANTENNAS_RX]; int32_t * rxp[NB_ANTENNAS_RX];
int32_t * txp[NB_ANTENNAS_TX]; int32_t * txp[NB_ANTENNAS_TX];
int start_rx_stream = 1; int start_rx_stream = 1;
...@@ -128,9 +130,12 @@ int main( int argc, char **argv ) { ...@@ -128,9 +130,12 @@ int main( int argc, char **argv ) {
for (int i=0; i<NB_ANTENNAS_RX; i++) { for (int i=0; i<NB_ANTENNAS_RX; i++) {
txp[i] = (int32_t *) malloc16_clear( txdata_size );
rxp[i] = (int32_t *) malloc16_clear( rxdata_size ); rxp[i] = (int32_t *) malloc16_clear( rxdata_size );
}
for (int i=0; i<NB_ANTENNAS_TX; i++) {
txp[i] = (int32_t *) malloc16_clear( txdata_size );
} }
int readBlockSize, writeBlockSize; int readBlockSize, writeBlockSize;
...@@ -150,7 +155,7 @@ int main( int argc, char **argv ) { ...@@ -150,7 +155,7 @@ int main( int argc, char **argv ) {
(void **)rxp, (void **)rxp,
readBlockSize, readBlockSize,
1); 1);
timestampold = timestamp;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, VCD_FUNCTION_OUT ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, VCD_FUNCTION_OUT );
clock_gettime(CLOCK_REALTIME,&time_stop); clock_gettime(CLOCK_REALTIME,&time_stop);
clock_gettime_cur = NR_TIMESPEC_TO_DOUBLE_US( nr_get_timespec_diff( &time_start, &time_stop ));//us clock_gettime_cur = NR_TIMESPEC_TO_DOUBLE_US( nr_get_timespec_diff( &time_start, &time_stop ));//us
...@@ -162,10 +167,13 @@ int main( int argc, char **argv ) { ...@@ -162,10 +167,13 @@ int main( int argc, char **argv ) {
clock_gettime(CLOCK_REALTIME,&time_stop); clock_gettime(CLOCK_REALTIME,&time_stop);
clock_gettime_cur = NR_TIMESPEC_TO_DOUBLE_US( nr_get_timespec_diff( &time_start, &time_stop ));//us clock_gettime_cur = NR_TIMESPEC_TO_DOUBLE_US( nr_get_timespec_diff( &time_start, &time_stop ));//us
if (clock_gettime_cur > 1000) if (clock_gettime_cur > 510)
printf("slot_num %d, time = %.2f sec, delay_time=%.2lf msec\n", absolute_slot, ((float)absolute_slot)/2/1000, clock_gettime_cur/1000); printf("slot_num %d, timestamp %ld, writeTimestamp %ld,time = %.2f sec, delay_time=%.2lf msec. readBlockSize %d. real read %ld.\n",
absolute_slot, timestamp, writeTimestamp, ((float)absolute_slot)/2/1000, clock_gettime_cur/1000,readBlockSize,(timestamp - timestampold));
clock_gettime(CLOCK_REALTIME,&time_start); clock_gettime(CLOCK_REALTIME,&time_start);
timestampold = timestamp;
#if 1
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, VCD_FUNCTION_IN ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, VCD_FUNCTION_IN );
rfdevice.trx_read_func(&rfdevice, rfdevice.trx_read_func(&rfdevice,
&timestamp, &timestamp,
...@@ -174,10 +182,12 @@ int main( int argc, char **argv ) { ...@@ -174,10 +182,12 @@ int main( int argc, char **argv ) {
1); 1);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, VCD_FUNCTION_OUT ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_READ, VCD_FUNCTION_OUT );
#endif
#if 1
// use previous timing_advance value to compute writeTimestamp // use previous timing_advance value to compute writeTimestamp
//writeTimestamp = timestamp+samples_per_subframe/20*5;// sent after 5 slot. //writeTimestamp = timestamp+samples_per_subframe/20*5;// sent after 5 slot.
writeTimestamp = timestamp+samples_per_subframe/2*5;// sent after 5 slot. writeTimestamp += timestamp+samples_per_subframe/2;// sent after 5 slot.
// but use current UE->timing_advance value to compute writeBlockSize // but use current UE->timing_advance value to compute writeBlockSize
...@@ -189,8 +199,8 @@ int main( int argc, char **argv ) { ...@@ -189,8 +199,8 @@ int main( int argc, char **argv ) {
1, 1,
1); 1);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, VCD_FUNCTION_OUT ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, VCD_FUNCTION_OUT );
#endif
} // while !oai_exit } // while !oai_exit
return 0; return 0;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment