Commit a81ec996 authored by Cedric Roux's avatar Cedric Roux

Merge remote-tracking branch 'origin/issue321_tdd_config1' into develop_integration_2018_w29

Conflicts:
	openair2/LAYER2/MAC/eNB_scheduler_primitives.c
parents 27f2557b 0205b521
......@@ -1056,13 +1056,9 @@ uint32_t pdcch_alloc2ul_frame(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame, ui
uint32_t ul_frame;
if ((frame_parms->frame_type == TDD) &&
(frame_parms->tdd_config == 1)) {
if ((n==1)||(n==6)||(n==4)||(n==9)) { // tdd_config 0,1 SF 1,5
(frame_parms->tdd_config == 1) &&
((n==1)||(n==6)||(n==4)||(n==9))) { // tdd_config 0,1 SF 1,5
ul_frame = (frame + (n < 5 ? 0 : 1));
} else {
LOG_E(PHY, "frame %d subframe %d: PUSCH frame = ?\n", frame, n);
ul_frame = 0;
}
} else if ((frame_parms->frame_type == TDD) &&
(frame_parms->tdd_config == 6) &&
((n==0)||(n==1)||(n==5)||(n==6)))
......
......@@ -343,25 +343,27 @@ void feptx_ofdm(RU_t *ru) {
}
}
*/
if ((fp->frame_type == TDD) &&
((fp->tdd_config==0) ||
(fp->tdd_config==1) ||
(fp->tdd_config==2) ||
(fp->tdd_config==6)) &&
((subframe==0) || (subframe==5))) {
// turn on tx switch N_TA_offset before
//LOG_D(HW,"subframe %d, time to switch to tx (N_TA_offset %d, slot_offset %d) \n",subframe,ru->N_TA_offset,slot_offset);
for (i=0; i<ru->N_TA_offset; i++) {
tx_offset = (int)slot_offset+i-ru->N_TA_offset/2;
if (tx_offset<0)
tx_offset += LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*fp->samples_per_tti;
if (tx_offset>=(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*fp->samples_per_tti))
tx_offset -= LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*fp->samples_per_tti;
ru->common.txdata[aa][tx_offset] = 0x00000000;
}
}
// if ((fp->frame_type == TDD) &&
// ((fp->tdd_config==0) ||
// (fp->tdd_config==1) ||
// (fp->tdd_config==2) ||
// (fp->tdd_config==6)) &&
// ((subframe==0) || (subframe==5))) {
// // turn on tx switch N_TA_offset before
// //LOG_D(HW,"subframe %d, time to switch to tx (N_TA_offset %d, slot_offset %d) \n",subframe,ru->N_TA_offset,slot_offset);
// for (i=0; i<ru->N_TA_offset; i++) {
// tx_offset = (int)slot_offset+i-ru->N_TA_offset/2;
// if (tx_offset<0)
// tx_offset += LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*fp->samples_per_tti;
//
// if (tx_offset>=(LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*fp->samples_per_tti))
// tx_offset -= LTE_NUMBER_OF_SUBFRAMES_PER_FRAME*fp->samples_per_tti;
//
// ru->common.txdata[aa][tx_offset] = 0x00000000;
// }
// }
stop_meas(&ru->ofdm_mod_stats);
LOG_D(PHY,"feptx_ofdm (TXPATH): frame %d, subframe %d: txp (time %p) %d dB, txp (freq) %d dB\n",
ru->proc.frame_tx,subframe,txdata,dB_fixed(signal_energy((int32_t*)txdata,fp->samples_per_tti)),
......
......@@ -102,7 +102,7 @@ typedef enum {
} ran_name_t;
typedef uint8_t xid_t;
typedef uint8_t mid_t; // module or enb id
typedef uint16_t mid_t; // module or enb id
typedef uint8_t lcid_t;
typedef int32_t err_code_t;
......
......@@ -3561,39 +3561,43 @@ extract_harq(module_id_t mod_idP, int CC_idP, int UE_id,
frame_tx = subframeP < 4 ? frameP -1 : frameP;
harq_pid = frame_subframe2_dl_harq_pid(cc->tdd_Config,frame_tx,subframe_tx);
RA_t *ra = &RC.mac[mod_idP]->common_channels[CC_idP].ra[0];
if(num_ack_nak==1){
if(harq_indication_tdd->harq_data[0].bundling.value_0==1){ //ack
sched_ctl->round[CC_idP][harq_pid] = 8; // release HARQ process
sched_ctl->tbcnt[CC_idP][harq_pid] = 0;
LOG_D(MAC,"frame %d subframe %d Acking (%d,%d) harq_pid %d round %d\n",frameP,subframeP,frame_tx,subframe_tx,harq_pid,sched_ctl->round[CC_idP][harq_pid]);
}else{ //nack
if( sched_ctl->round[CC_idP][harq_pid]<8) sched_ctl->round[CC_idP][harq_pid]++;
LOG_D(MAC,"frame %d subframe %d Nacking (%d,%d) harq_pid %d round %d\n",frameP,subframeP,frame_tx,subframe_tx,harq_pid,sched_ctl->round[CC_idP][harq_pid]);
if(sched_ctl->round[CC_idP][harq_pid] == 8){
for (uint8_t ra_i = 0; ra_i < NB_RA_PROC_MAX; ra_i++) {
if((ra[ra_i].rnti == rnti) && (ra[ra_i].state == WAITMSG4ACK)){
//Msg NACK num to MAC ,remove UE
// add UE info to freeList
LOG_I(MAC, "put UE %x into freeList\n", rnti);
put_UE_in_freelist(mod_idP, rnti, 1);
}
}
}
}
}
for (uint8_t ra_i = 0; ra_i < NB_RA_PROC_MAX; ra_i++) {
if ((ra[ra_i].rnti == rnti) && (ra[ra_i].state == MSGCRNTI_ACK) && (ra[ra_i].crnti_harq_pid == harq_pid)) {
LOG_D(MAC,"CRNTI Reconfiguration: ACK %d rnti %x round %d frame %d subframe %d \n",harq_indication_tdd->harq_data[0].bundling.value_0,rnti,sched_ctl->round[CC_idP][harq_pid],frameP,subframeP);
if(num_ack_nak == 1 && harq_indication_tdd->harq_data[0].bundling.value_0 == 1) {
cancel_ra_proc(mod_idP, CC_idP, frameP, ra[ra_i].rnti);
}else{
if(sched_ctl->round[CC_idP][harq_pid] == 7){
cancel_ra_proc(mod_idP, CC_idP, frameP, ra[ra_i].rnti);
}
}
break;
}
if(num_ack_nak==1){
if(harq_indication_tdd->harq_data[0].bundling.value_0==1){ //ack
sched_ctl->round[CC_idP][harq_pid] = 8; // release HARQ process
sched_ctl->tbcnt[CC_idP][harq_pid] = 0;
LOG_D(MAC,"frame %d subframe %d Acking (%d,%d) harq_pid %d round %d\n",frameP,subframeP,frame_tx,subframe_tx,harq_pid,sched_ctl->round[CC_idP][harq_pid]);
}else{ //nack
if( sched_ctl->round[CC_idP][harq_pid]<8) sched_ctl->round[CC_idP][harq_pid]++;
if (sched_ctl->round[CC_idP][harq_pid] == 4) {
sched_ctl->round[CC_idP][harq_pid] = 8; // release HARQ process
sched_ctl->tbcnt[CC_idP][harq_pid] = 0;
}
LOG_D(MAC,"frame %d subframe %d Nacking (%d,%d) harq_pid %d round %d\n",frameP,subframeP,frame_tx,subframe_tx,harq_pid,sched_ctl->round[CC_idP][harq_pid]);
if(sched_ctl->round[CC_idP][harq_pid] == 8){
for (uint8_t ra_i = 0; ra_i < NB_RA_PROC_MAX; ra_i++) {
if((ra[ra_i].rnti == rnti) && (ra[ra_i].state == WAITMSG4ACK)){
//Msg NACK num to MAC ,remove UE
// add UE info to freeList
LOG_I(RRC, "put UE %x into freeList\n", rnti);
put_UE_in_freelist(mod_idP, rnti, 1);
}
}
}
}
}
for (uint8_t ra_i = 0; ra_i < NB_RA_PROC_MAX; ra_i++) {
if ((ra[ra_i].rnti == rnti) && (ra[ra_i].state == MSGCRNTI_ACK) && (ra[ra_i].crnti_harq_pid == harq_pid)) {
LOG_D(MAC,"CRNTI Reconfiguration: ACK %d rnti %x round %d frame %d subframe %d \n",harq_indication_tdd->harq_data[0].bundling.value_0,rnti,sched_ctl->round[CC_idP][harq_pid],frameP,subframeP);
if(num_ack_nak == 1 && harq_indication_tdd->harq_data[0].bundling.value_0 == 1) {
cancel_ra_proc(mod_idP, CC_idP, frameP, ra[ra_i].rnti);
}else{
if(sched_ctl->round[CC_idP][harq_pid] == 7){
cancel_ra_proc(mod_idP, CC_idP, frameP, ra[ra_i].rnti);
}
}
break;
}
}
}
break;
......@@ -4481,18 +4485,11 @@ static int nack_or_dtx_reported(
int i;
if (cc->tdd_Config) {
nfapi_harq_indication_tdd_rel13_t *harq_indication_tdd = &harq_pdu->harq_indication_tdd_rel13;
// AssertFatal(0==1, "TDD to be done. FAPI structures (see nfapi_harq_indication_tdd_rel13_t) are not clean. To be cleaned as well?\n");
AssertFatal(harq_indication_tdd->number_of_ack_nack==1,"number of ack/nak %d != 1\n",harq_indication_tdd->number_of_ack_nack);
switch (harq_indication_tdd->mode) {
case 0: // Format 1a/b bundling
if (harq_indication_tdd->harq_data[0].bundling.value_0 == 1) return 1;
return 0;
break;
default:
AssertFatal(1==0,"harq_indication_tdd type is not bundling\n");
break;
}
nfapi_harq_indication_tdd_rel13_t *hi = &harq_pdu->harq_indication_tdd_rel13;
for (i = 0; i < hi->number_of_ack_nack; hi++)
if (hi->harq_data[0].bundling.value_0 != 1) //only bundling is used for tdd for now
return 1;
return 0;
} else {
nfapi_harq_indication_fdd_rel13_t *hi = &harq_pdu->harq_indication_fdd_rel13;
for (i = 0; i < hi->number_of_ack_nack; hi++)
......
......@@ -860,7 +860,7 @@ pdcp_data_ind(
void pdcp_update_stats(const protocol_ctxt_t* const ctxt_pP){
uint8_t pdcp_uid = 0;
uint16_t pdcp_uid = 0;
uint8_t rb_id = 0;
// these stats are measured for both eNB and UE on per seond basis
......
......@@ -1940,7 +1940,7 @@ int rrc_eNB_process_PAGING_IND(MessageDef *msg_p, const char *msg_name, instance
/* insert data to UE_PF_PO or update data in UE_PF_PO */
pthread_mutex_lock(&ue_pf_po_mutex);
uint8_t i = 0;
uint16_t i = 0;
for (i = 0; i < MAX_MOBILES_PER_ENB; i++) {
if ((UE_PF_PO[CC_id][i].enable_flag == TRUE && UE_PF_PO[CC_id][i].ue_index_value == (uint16_t)(S1AP_PAGING_IND(msg_p).ue_index_value))
|| (UE_PF_PO[CC_id][i].enable_flag != TRUE)) {
......
......@@ -309,7 +309,7 @@ void log_getconfig(log_t *g_log) {
logparams_logfile[i].optname[j] = tolower(logparams_logfile[i].optname[j]);
/* */
logparams_level[i].defstrval = gloglevel;
logparams_verbosity[i].defstrval = glogverbo;
logparams_verbosity[i].defstrval = glogverbo;
logparams_logfile[i].defstrval = malloc(strlen(g_log->log_component[i].name) + 16);
sprintf(logparams_logfile[i].defstrval,"/tmp/oai%s.log",g_log->log_component[i].name);
logparams_logfile[i].numelt = 0;
......@@ -332,7 +332,7 @@ void log_getconfig(log_t *g_log) {
if ( logparams_logfile[i].defstrval != NULL) {
free (logparams_logfile[i].defstrval);
}
}
}
}
int register_log_component(char *name, char *fext, int compidx)
......@@ -536,7 +536,7 @@ int logInit_log_mem (void)
if ((pthread_mutex_init (&log_mem_lock, NULL) != 0)
|| (pthread_cond_init (&log_mem_notify, NULL) != 0)) {
log_mem_d[1].enable_flag=0;
return 0;
return -1;
}
pthread_create(&log_mem_thread, NULL, (void *(*)(void *))log_mem_write, (void*)NULL);
}else{
......@@ -576,7 +576,7 @@ void nfapi_log(const char *file, const char *func, int line, int comp, int level
/* for no gcc warnings */
(void)log_start;
(void)log_end;
c = &g_log->log_component[comp];
......@@ -669,9 +669,44 @@ void nfapi_log(const char *file, const char *func, int line, int comp, int level
va_end(args);
// OAI printf compatibility
if ((g_log->onlinelog == 1) && (level != LOG_FILE))
if ((g_log->onlinelog == 1) && (level != LOG_FILE)) {
if(log_mem_flag==1){
if(log_mem_d[log_mem_side].enable_flag==1){
int temp_index;
temp_index=log_mem_d[log_mem_side].buf_index;
if(temp_index+len+1 < LOG_MEM_SIZE){
log_mem_d[log_mem_side].buf_index+=len;
memcpy(&log_mem_d[log_mem_side].buf_p[temp_index],log_buffer,len);
}else{
log_mem_d[log_mem_side].enable_flag=0;
if(log_mem_d[1-log_mem_side].enable_flag==1){
temp_index=log_mem_d[1-log_mem_side].buf_index;
if(temp_index+len+1 < LOG_MEM_SIZE){
log_mem_d[1-log_mem_side].buf_index+=len;
log_mem_side=1-log_mem_side;
memcpy(&log_mem_d[log_mem_side].buf_p[temp_index],log_buffer,len);
/* write down !*/
if (pthread_mutex_lock(&log_mem_lock) != 0) {
return;
}
if(log_mem_write_flag==0){
log_mem_write_side=1-log_mem_side;
if(pthread_cond_signal(&log_mem_notify) != 0) {
}
}
if(pthread_mutex_unlock(&log_mem_lock) != 0) {
return;
}
}else{
log_mem_d[1-log_mem_side].enable_flag=0;
}
}
}
}
}else{
fwrite(log_buffer, len, 1, stdout);
}
}
if (g_log->syslog) {
syslog(g_log->level, "%s", log_buffer);
......
......@@ -2763,7 +2763,10 @@ void init_RU(char *rf_config_file) {
void stop_ru(RU_t *ru) {
#if defined(PRE_SCD_THREAD) || defined(PHY_TX_THREAD)
int *status;
#endif
printf("Stopping RU %p processing threads\n",(void*)ru);
#if defined(PRE_SCD_THREAD)
if(ru){
......
......@@ -1228,6 +1228,7 @@ int main( int argc, char **argv )
// connect the TX/RX buffers
sleep(1); /* wait for thread activation */
printf("Sending sync to all threads\n");
......
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