Commit 61a24472 authored by WANG Tsu-Han's avatar WANG Tsu-Han

assertion removal and debuging message adding

parent d83c935e
......@@ -717,6 +717,7 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) {
NR_DL_FRAME_PARMS *fp = ru->nr_frame_parms;
//nfapi_nr_config_request_t *cfg = &ru->gNB_list[0]->gNB_config;
void *txp[ru->nb_tx];
char *print_test[ru->nb_tx];
unsigned int txs;
int i;
T(T_ENB_PHY_OUTPUT_SIGNAL, T_INT(0), T_INT(0), T_INT(frame), T_INT(slot),
......@@ -761,23 +762,27 @@ void tx_rf(RU_t *ru,int frame,int slot, uint64_t timestamp) {
for (i=0; i<ru->nb_tx; i++){
txp[i] = (void *)&ru->common.txdata[i][(slot*fp->samples_per_slot)-sf_extension];
}
print_test[0] = (char *)&ru->common.txdata[0][(slot*fp->samples_per_slot)-sf_extension];
printf("txdata[0] = %d\n", print_test[0]);
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, (timestamp-ru->openair0_cfg.tx_sample_advance)&0xffffffff );
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 1 );
// prepare tx buffer pointers
start_meas(&ru->tx_fhaul);
printf("sending trx write from tx_rf\n");
txs = ru->rfdevice.trx_write_func(&ru->rfdevice,
timestamp+ru->ts_offset-ru->openair0_cfg.tx_sample_advance-sf_extension,
txp,
siglen+sf_extension,
ru->nb_tx,
flags);
//printf("txp = %s\n", (char*)txp[0]);
stop_meas(&ru->tx_fhaul);
LOG_D(PHY,"[TXPATH] RU %d tx_rf, writing to TS %llu, frame %d, unwrapped_frame %d, subframe %d\n",ru->idx,
(long long unsigned int)timestamp,frame,proc->frame_tx_unwrap,slot);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 0 );
AssertFatal(txs == siglen+sf_extension,"TX : Timeout (sent %u/%d)\n", txs, siglen);
//AssertFatal(txs == siglen+sf_extension,"TX : Timeout (sent %u/%d)\n", txs, siglen);
}
}
......@@ -1446,7 +1451,7 @@ static void *ru_thread( void *param ) {
if ((ru->is_slave) && (ru->if_south == LOCAL_RF)) do_ru_synch(ru);
// start trx write thread
start_write_thread(ru);
ru->start_write_thread(ru);
}
pthread_mutex_lock(&proc->mutex_FH1);
......@@ -2051,6 +2056,7 @@ void set_function_spec_param(RU_t *ru) {
ru->fh_south_out = tx_rf; // local synchronous RF TX
ru->start_rf = start_rf; // need to start the local RF interface
ru->stop_rf = stop_rf;
ru->start_write_thread = start_write_thread; // starting RF TX in different thread
printf("configuring ru_id %u (start_rf %p)\n", ru->idx, start_rf);
/*
if (ru->function == gNodeB_3GPP) { // configure RF parameters only for 3GPP eNodeB, we need to get them from RAU otherwise
......
......@@ -538,6 +538,8 @@ typedef struct RU_t_s {
void (*wakeup_prach_gNB)(struct PHY_VARS_gNB_s *gNB, struct RU_t_s *ru, int frame, int subframe);
/// function pointer to wakeup routine in lte-enb.
void (*wakeup_prach_eNB_br)(struct PHY_VARS_eNB_s *eNB, struct RU_t_s *ru, int frame, int subframe);
/// function pointer to start a thread of tx write for USRP.
int (*start_write_thread)(struct RU_t_s *ru);
/// function pointer to NB entry routine
void (*eNB_top)(struct PHY_VARS_eNB_s *eNB, int frame_rx, int subframe_rx, char *string, struct RU_t_s *ru);
......
......@@ -440,23 +440,25 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp,
first_packet_state = false;
last_packet_state = true;
}
printf("~~~1 buff in usrp write = %d\n", buff[0]);
pthread_mutex_lock(&write_thread->mutex_write);
write_thread->end = (write_thread->end + 1)% write_thread->num_package;
end = write_thread->end;
printf("package being write is %d\n", end);
write_package[end].timestamp = timestamp;
write_package[end].nsamps = nsamps;
write_package[end].cc = cc;
write_package[end].first_packet = first_packet_state;
write_package[end].last_packet = last_packet_state;
write_package[end].buff = buff;
printf("~~~2 write_package buff in usrp write = %d\n", write_package[end].buff[0]);
write_thread->instance_cnt_write = 0;
write_thread->end = (write_thread->end + 1)% write_thread->num_package;
pthread_cond_signal(&write_thread->cond_write);
printf("trx_usrp_write signal end\n");
pthread_mutex_unlock(&write_thread->mutex_write);
return ret;
return 0;
}
//-----------------------start--------------------------
......@@ -474,7 +476,15 @@ void *trx_usrp_write_thread(void * arg){
openair0_thread_t *write_thread = &device->write_thread;
openair0_write_package_t *write_package = write_thread->write_package;
usrp_state_t *s;
int nsamps2; // aligned to upper 32 or 16 byte boundary
int start;
openair0_timestamp timestamp;
void **buff;
int nsamps;
int cc;
signed char first_packet;
signed char last_packet;
while(1){
pthread_mutex_lock(&write_thread->mutex_write);
......@@ -483,23 +493,24 @@ void *trx_usrp_write_thread(void * arg){
pthread_cond_wait(&write_thread->cond_write,&write_thread->mutex_write); // this unlocks mutex_rxtx while waiting and then locks it again
}
printf("signal unlock\n");
int start = write_thread->start;
printf("start = %d, end = %d\n", start, write_thread->end);
openair0_timestamp timestamp = write_package[start].timestamp;
void **buff = write_package[start].buff;
int nsamps = write_package[start].nsamps;
int cc = write_package[start].cc;
bool first_packet = write_package[start].first_packet;
bool last_packet = write_package[start].last_packet;
if(write_thread->end == (write_thread->start + 1)% write_thread->num_package){
s = (usrp_state_t *)device->priv;
start = write_thread->start;
printf("package bing use is start = %d, end = %d\n", start, write_thread->end);
timestamp = write_package[start].timestamp;
buff = write_package[start].buff;
nsamps = write_package[start].nsamps;
cc = write_package[start].cc;
first_packet = write_package[start].first_packet;
last_packet = write_package[start].last_packet;
write_thread->start = (write_thread->start + 1)% write_thread->num_package;
if(write_thread->end == write_thread->start){
write_thread->instance_cnt_write = -1;
}
write_thread->start = (write_thread->start + 1)% write_thread->num_package;
pthread_mutex_unlock(&write_thread->mutex_write);
printf("end of write thread signal getting \n");
printf("~~~2.5 write_package buff in thread = %d\n", write_package[start].buff[0]);
printf("~~~3 buff in tx write thread= %d\n", buff[0]);
usrp_state_t *s = (usrp_state_t *)device->priv;
int nsamps2; // aligned to upper 32 or 16 byte boundary
#if defined(__x86_64) || defined(__i386__)
#ifdef __AVX2__
nsamps2 = (nsamps+7)>>3;
......@@ -545,6 +556,7 @@ void *trx_usrp_write_thread(void * arg){
ret = (int)s->tx_stream->send(buff_ptrs, nsamps, s->tx_md);
} else ret = (int)s->tx_stream->send(&(((int16_t *)buff_tx[0])[0]), nsamps, s->tx_md);
if (ret != nsamps) LOG_E(HW,"[xmit] tx samples %d != %d\n",ret,nsamps);
printf("end of sending buffer in trx write thread\n");
if(0) break;
}
......
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