Commit 461990a1 authored by Francesco Mani's avatar Francesco Mani

changes in pucch2 indication

parent ae0c02b2
...@@ -394,7 +394,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, ...@@ -394,7 +394,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
// first bit of bitmap for sr presence and second bit for acknack presence // first bit of bitmap for sr presence and second bit for acknack presence
uci_pdu->pduBitmap = pucch_pdu->sr_flag | ((pucch_pdu->bit_len_harq>0)<<1); uci_pdu->pduBitmap = pucch_pdu->sr_flag | ((pucch_pdu->bit_len_harq>0)<<1);
uci_pdu->pucch_format = 0; // format 0 uci_pdu->pucch_format = 0; // format 0
uci_pdu->ul_cqi = cqi; // currently not valid uci_pdu->ul_cqi = cqi;
uci_pdu->timing_advance = 0xffff; // currently not valid uci_pdu->timing_advance = 0xffff; // currently not valid
uci_pdu->rssi = 1280 - (10*dB_fixed(32767*32767)-dB_fixed_times10(signal_energy(&rxdataF[0][pucch_pdu->start_symbol_index*frame_parms->ofdm_symbol_size+re_offset],12))); uci_pdu->rssi = 1280 - (10*dB_fixed(32767*32767)-dB_fixed_times10(signal_energy(&rxdataF[0][pucch_pdu->start_symbol_index*frame_parms->ofdm_symbol_size+re_offset],12)));
if (pucch_pdu->bit_len_harq==0) { if (pucch_pdu->bit_len_harq==0) {
...@@ -1494,7 +1494,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, ...@@ -1494,7 +1494,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
} }
} // cw loop } // cw loop
corr_dB = dB_fixed64((uint64_t)corr); corr_dB = dB_fixed64((uint64_t)corr);
LOG_D(PHY,"cw_ML %d, metric %d dB\n",cw_ML,corr_dB); LOG_I(PHY,"cw_ML %d, metric %d dB\n",cw_ML,corr_dB);
decodedPayload[0]=(uint64_t)cw_ML; decodedPayload[0]=(uint64_t)cw_ML;
} }
else { // polar coded case else { // polar coded case
...@@ -1629,21 +1629,29 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, ...@@ -1629,21 +1629,29 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
corr_dB = dB_fixed64(corr); corr_dB = dB_fixed64(corr);
LOG_D(PHY,"metric %d dB\n",corr_dB); LOG_D(PHY,"metric %d dB\n",corr_dB);
} }
re_offset = (12*pucch_pdu->prb_start) + (12*pucch_pdu->bwp_start) + frame_parms->first_carrier_offset;
// estimate CQI for MAC (from antenna port 0 only)
int SNRtimes10 = dB_fixed_times10(signal_energy(&rxdataF[0][(l2*frame_parms->ofdm_symbol_size)+re_offset],12*pucch_pdu->prb_size)) - (10*gNB->measurements.n0_power_tot_dB);
int cqi;
if (SNRtimes10 < -640) cqi=0;
else if (SNRtimes10 > 635) cqi=255;
else cqi=(640+SNRtimes10)/5;
uci_pdu->harq.harq_bit_len = pucch_pdu->bit_len_harq; uci_pdu->harq.harq_bit_len = pucch_pdu->bit_len_harq;
uci_pdu->pduBitmap=0; uci_pdu->pduBitmap=0;
uci_pdu->rnti=pucch_pdu->rnti; uci_pdu->rnti=pucch_pdu->rnti;
uci_pdu->handle=pucch_pdu->handle; uci_pdu->handle=pucch_pdu->handle;
uci_pdu->pucch_format=0; uci_pdu->pucch_format=0;
uci_pdu->ul_cqi=corr_dB; uci_pdu->ul_cqi=cqi;
// need to fill these field! uci_pdu->timing_advance=0xffff; // currently not valid
uci_pdu->timing_advance=31; uci_pdu->rssi=1280 - (10*dB_fixed(32767*32767)-dB_fixed_times10(signal_energy(&rxdataF[0][(l2*frame_parms->ofdm_symbol_size)+re_offset],12*pucch_pdu->prb_size)));
uci_pdu->rssi=0;
if (pucch_pdu->bit_len_harq>0) { if (pucch_pdu->bit_len_harq>0) {
int harq_bytes=pucch_pdu->bit_len_harq>>3; int harq_bytes=pucch_pdu->bit_len_harq>>3;
if ((pucch_pdu->bit_len_harq&7) > 0) harq_bytes++; if ((pucch_pdu->bit_len_harq&7) > 0) harq_bytes++;
uci_pdu->pduBitmap|=1; uci_pdu->pduBitmap|=1;
uci_pdu->harq.harq_payload = (uint8_t*)malloc(harq_bytes); uci_pdu->harq.harq_payload = (uint8_t*)malloc(harq_bytes);
uci_pdu->harq.harq_crc = decoderState > 0 ? 1 : 0; uci_pdu->harq.harq_crc = decoderState;
int i=0; int i=0;
for (;i<harq_bytes-1;i++) { for (;i<harq_bytes-1;i++) {
uci_pdu->harq.harq_payload[i] = decodedPayload[0] & 255; uci_pdu->harq.harq_payload[i] = decodedPayload[0] & 255;
...@@ -1666,7 +1674,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, ...@@ -1666,7 +1674,7 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
int csi_part1_bytes=pucch_pdu->bit_len_csi_part1>>3; int csi_part1_bytes=pucch_pdu->bit_len_csi_part1>>3;
if ((pucch_pdu->bit_len_csi_part1&7) > 0) csi_part1_bytes++; if ((pucch_pdu->bit_len_csi_part1&7) > 0) csi_part1_bytes++;
uci_pdu->csi_part1.csi_part1_payload = (uint8_t*)malloc(csi_part1_bytes); uci_pdu->csi_part1.csi_part1_payload = (uint8_t*)malloc(csi_part1_bytes);
uci_pdu->csi_part1.csi_part1_crc = decoderState > 0 ? 1 : 0; uci_pdu->csi_part1.csi_part1_crc = decoderState;
int i=0; int i=0;
for (;i<csi_part1_bytes-1;i++) { for (;i<csi_part1_bytes-1;i++) {
uci_pdu->csi_part1.csi_part1_payload[i] = decodedPayload[0] & 255; uci_pdu->csi_part1.csi_part1_payload[i] = decodedPayload[0] & 255;
...@@ -1679,6 +1687,5 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB, ...@@ -1679,6 +1687,5 @@ void nr_decode_pucch2(PHY_VARS_gNB *gNB,
if (pucch_pdu->bit_len_csi_part2>0) { if (pucch_pdu->bit_len_csi_part2>0) {
uci_pdu->pduBitmap|=8; uci_pdu->pduBitmap|=8;
} }
} }
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