Merge branch 'NR_SA_F1AP_5GRECORDS' of https://gitlab.eurecom.fr/oai/openairinterface5g into NR_SA_F1AP_5GRECORDS
Conflicts: openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c
This commit is contained in:
@@ -111,8 +111,6 @@ const size_t nr_bandtable_size = sizeof(nr_bandtable) / sizeof(nr_bandentry_t);
|
||||
int NRRIV2BW(int locationAndBandwidth,int N_RB) {
|
||||
int tmp = locationAndBandwidth/N_RB;
|
||||
int tmp2 = locationAndBandwidth%N_RB;
|
||||
|
||||
|
||||
if (tmp <= ((N_RB>>1)+1) && (tmp+tmp2)<N_RB) return(tmp+1);
|
||||
else return(N_RB+1-tmp);
|
||||
|
||||
@@ -121,8 +119,6 @@ int NRRIV2BW(int locationAndBandwidth,int N_RB) {
|
||||
int NRRIV2PRBOFFSET(int locationAndBandwidth,int N_RB) {
|
||||
int tmp = locationAndBandwidth/N_RB;
|
||||
int tmp2 = locationAndBandwidth%N_RB;
|
||||
|
||||
|
||||
if (tmp <= ((N_RB>>1)+1) && (tmp+tmp2)<N_RB) return(tmp2);
|
||||
else return(N_RB-1-tmp2);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
|
||||
/// RX_IND
|
||||
#define FAPI_NR_RX_PDU_TYPE_MIB 0x01
|
||||
#define FAPI_NR_RX_PDU_TYPE_SSB 0x01
|
||||
#define FAPI_NR_RX_PDU_TYPE_SIB 0x02
|
||||
#define FAPI_NR_RX_PDU_TYPE_DLSCH 0x03
|
||||
#define FAPI_NR_DCI_IND 0x04
|
||||
|
||||
@@ -111,8 +111,8 @@ typedef struct {
|
||||
uint8_t ssb_index;
|
||||
uint8_t ssb_length;
|
||||
uint16_t cell_id;
|
||||
|
||||
} fapi_nr_mib_pdu_t;
|
||||
uint16_t ssb_start_subcarrier;
|
||||
} fapi_nr_ssb_pdu_t;
|
||||
|
||||
typedef struct {
|
||||
uint32_t pdu_length;
|
||||
@@ -124,7 +124,7 @@ typedef struct {
|
||||
uint8_t pdu_type;
|
||||
union {
|
||||
fapi_nr_pdsch_pdu_t pdsch_pdu;
|
||||
fapi_nr_mib_pdu_t mib_pdu;
|
||||
fapi_nr_ssb_pdu_t ssb_pdu;
|
||||
fapi_nr_sib_pdu_t sib_pdu;
|
||||
};
|
||||
} fapi_nr_rx_indication_body_t;
|
||||
|
||||
@@ -94,6 +94,7 @@ void nr_generate_dci(PHY_VARS_gNB *gNB,
|
||||
* in time: by its first slot and its first symbol*/
|
||||
const nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu_rel15->dci_pdu[d];
|
||||
|
||||
LOG_D(PHY,"DCI pdu %d, rnti %x, aggregation %d CCE %d Scrambling_Id %x ScramblingRNTI %x PayloadSizeBits %d\n",d,dci_pdu->RNTI,dci_pdu->AggregationLevel,dci_pdu->CceIndex,dci_pdu->ScramblingId,dci_pdu->ScramblingRNTI,dci_pdu->PayloadSizeBits);
|
||||
cset_start_symb = pdcch_pdu_rel15->StartSymbolIndex;
|
||||
cset_nsymb = pdcch_pdu_rel15->DurationSymbols;
|
||||
dci_idx = 0;
|
||||
|
||||
@@ -256,10 +256,8 @@ void nr_fill_dci(PHY_VARS_gNB *gNB,
|
||||
dlsch->rnti = pdcch_pdu_rel15->dci_pdu[i].RNTI;
|
||||
|
||||
// nr_fill_cce_list(gNB,0);
|
||||
/*
|
||||
LOG_D(PHY, "DCI PDU: [0]->0x%lx \t [1]->0x%lx \n",dci_pdu[0], dci_pdu[1]);
|
||||
LOG_D(PHY, "DCI type %d payload (size %d) generated on candidate %d\n", dci_alloc->pdcch_params.dci_format, dci_alloc->size, cand_idx);
|
||||
*/
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -162,6 +162,7 @@ uint8_t nr_generate_pdsch(PHY_VARS_gNB *gNB,
|
||||
uint32_t encoded_length = nb_re*Qm;
|
||||
int16_t mod_dmrs[14][n_dmrs<<1] __attribute__ ((aligned(16)));
|
||||
|
||||
|
||||
/* PTRS */
|
||||
uint16_t beta_ptrs = 1;
|
||||
uint8_t ptrs_symbol = 0;
|
||||
|
||||
@@ -173,6 +173,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
||||
|
||||
pucch_GroupHopping_t pucch_GroupHopping = pucch_pdu->group_hop_flag + (pucch_pdu->sequence_hop_flag<<1);
|
||||
|
||||
|
||||
AssertFatal(pucch_pdu->bit_len_harq > 0 || pucch_pdu->sr_flag > 0,
|
||||
"Either bit_len_harq (%d) or sr_flag (%d) must be > 0\n",
|
||||
pucch_pdu->bit_len_harq,pucch_pdu->sr_flag);
|
||||
@@ -190,6 +191,8 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
||||
nr_sequences=8>>(1-pucch_pdu->sr_flag);
|
||||
}
|
||||
|
||||
LOG_I(PHY,"pucch0: nr_symbols %d, start_symbol %d, prb_start %d, second_hop_prb %d, group_hop_flag %d, sequence_hop_flag %d, O_ACK %d, O_SR %d, mcs %d\n",pucch_pdu->nr_of_symbols,pucch_pdu->start_symbol_index,pucch_pdu->prb_start,pucch_pdu->second_hop_prb,pucch_pdu->group_hop_flag,pucch_pdu->sequence_hop_flag,pucch_pdu->bit_len_harq,pucch_pdu->sr_flag,mcs[0]);
|
||||
|
||||
int cs_ind = get_pucch0_cs_lut_index(gNB,pucch_pdu);
|
||||
/*
|
||||
* Implement TS 38.211 Subclause 6.3.2.3.1 Sequence generation
|
||||
@@ -216,149 +219,96 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
||||
* x(l*12+n) = r_u_v_alpha_delta(n)
|
||||
*/
|
||||
// the value of u,v (delta always 0 for PUCCH) has to be calculated according to TS 38.211 Subclause 6.3.2.2.1
|
||||
uint8_t u=0,v=0;//,delta=0;
|
||||
// if frequency hopping is disabled by the higher-layer parameter PUCCH-frequency-hopping
|
||||
// n_hop = 0
|
||||
// if frequency hopping is enabled by the higher-layer parameter PUCCH-frequency-hopping
|
||||
// n_hop = 0 for first hop
|
||||
// n_hop = 1 for second hop
|
||||
uint8_t n_hop = 0; // Frequnecy hopping not implemented FIXME!!
|
||||
uint8_t u[2]={0,0},v[2]={0,0};
|
||||
|
||||
// x_n contains the sequence r_u_v_alpha_delta(n)
|
||||
|
||||
int n,i,l;
|
||||
nr_group_sequence_hopping(pucch_GroupHopping,pucch_pdu->hopping_id,n_hop,slot,&u,&v); // calculating u and v value
|
||||
int prb_offset[2] = {pucch_pdu->prb_start, pucch_pdu->prb_start};
|
||||
|
||||
nr_group_sequence_hopping(pucch_GroupHopping,pucch_pdu->hopping_id,0,slot,&u[0],&v[0]); // calculating u and v value first hop
|
||||
LOG_I(PHY,"pucch0: u %d, v %d\n",u[0],v[0]);
|
||||
|
||||
|
||||
if (pucch_pdu->freq_hop_flag == 1) {
|
||||
nr_group_sequence_hopping(pucch_GroupHopping,pucch_pdu->hopping_id,1,slot,&u[1],&v[1]); // calculating u and v value second hop
|
||||
LOG_I(PHY,"pucch0 second hop: u %d, v %d\n",u[1],v[1]);
|
||||
prb_offset[1] = pucch_pdu->second_hop_prb;
|
||||
}
|
||||
|
||||
AssertFatal(pucch_pdu->nr_of_symbols < 3,"nr_of_symbols %d not allowed\n",pucch_pdu->nr_of_symbols);
|
||||
uint32_t re_offset=0;
|
||||
uint8_t l2;
|
||||
|
||||
#ifdef OLD_IMPL
|
||||
int16_t x_n_re[nr_sequences][24],x_n_im[nr_sequences][24];
|
||||
const int16_t *x_re[2],*x_im[2];
|
||||
x_re[0] = table_5_2_2_2_2_Re[u[0]];
|
||||
x_im[0] = table_5_2_2_2_2_Im[u[0]];
|
||||
x_re[1] = table_5_2_2_2_2_Re[u[1]];
|
||||
x_im[1] = table_5_2_2_2_2_Im[u[1]];
|
||||
|
||||
for(i=0;i<nr_sequences;i++){
|
||||
// we proceed to calculate alpha according to TS 38.211 Subclause 6.3.2.2.2
|
||||
for (l=0; l<pucch_pdu->nr_of_symbols; l++){
|
||||
double alpha = nr_cyclic_shift_hopping(pucch_pdu->hopping_id,pucch_pdu->initial_cyclic_shift,mcs[i],l,pucch_pdu->start_symbol_index,slot);
|
||||
#ifdef DEBUG_NR_PUCCH_RX
|
||||
printf("\t [nr_generate_pucch0] sequence generation \tu=%d \tv=%d \talpha=%lf \t(for symbol l=%d/%d,mcs %d)\n",u,v,alpha,l,l+pucch_pdu->start_symbol_index,mcs[i]);
|
||||
printf("lut output %d\n",gNB->pucch0_lut.lut[cs_ind][slot][l+pucch_pdu->start_symbol_index]);
|
||||
#endif
|
||||
alpha=0.0;
|
||||
for (n=0; n<12; n++){
|
||||
x_n_re[i][(12*l)+n] = (int16_t)((int16_t)(((((int32_t)(round(32767*cos(alpha*n))) * table_5_2_2_2_2_Re[u][n])>>15)
|
||||
- (((int32_t)(round(32767*sin(alpha*n))) * table_5_2_2_2_2_Im[u][n])>>15)))); // Re part of base sequence shifted by alpha
|
||||
x_n_im[i][(12*l)+n] =(int16_t)((int16_t)(((((int32_t)(round(32767*cos(alpha*n))) * table_5_2_2_2_2_Im[u][n])>>15)
|
||||
+ (((int32_t)(round(32767*sin(alpha*n))) * table_5_2_2_2_2_Re[u][n])>>15)))); // Im part of base sequence shifted by alpha
|
||||
#ifdef DEBUG_NR_PUCCH_RX
|
||||
printf("\t [nr_generate_pucch0] sequence generation \tu=%d \tv=%d \talpha=%lf \tx_n(l=%d,n=%d)=(%d,%d) %d,%d\n",
|
||||
u,v,alpha,l,n,x_n_re[i][(12*l)+n],x_n_im[i][(12*l)+n],
|
||||
(int32_t)(round(32767*cos(alpha*n))),
|
||||
(int32_t)(round(32767*sin(alpha*n))));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Implementing TS 38.211 Subclause 6.3.2.3.2 Mapping to physical resources
|
||||
*/
|
||||
|
||||
int16_t r_re[24],r_im[24];
|
||||
|
||||
for (l=0; l<pucch_pdu->nr_of_symbols; l++) {
|
||||
|
||||
l2 = l+pucch_pdu->start_symbol_index;
|
||||
re_offset = (12*pucch_pdu->prb_start) + (12*pucch_pdu->bwp_start) + frame_parms->first_carrier_offset;
|
||||
if (re_offset>= frame_parms->ofdm_symbol_size)
|
||||
re_offset-=frame_parms->ofdm_symbol_size;
|
||||
|
||||
for (n=0; n<12; n++){
|
||||
|
||||
r_re[(12*l)+n]=((int16_t *)&rxdataF[0][(l2*frame_parms->ofdm_symbol_size)+re_offset])[0];
|
||||
r_im[(12*l)+n]=((int16_t *)&rxdataF[0][(l2*frame_parms->ofdm_symbol_size)+re_offset])[1];
|
||||
#ifdef DEBUG_NR_PUCCH_RX
|
||||
printf("\t [nr_generate_pucch0] mapping to RE \tofdm_symbol_size=%d \tN_RB_DL=%d \tfirst_carrier_offset=%d \ttxptr(%d)=(x_n(l=%d,n=%d)=(%d,%d))\n",
|
||||
frame_parms->ofdm_symbol_size,frame_parms->N_RB_DL,frame_parms->first_carrier_offset,(l2*frame_parms->ofdm_symbol_size)+re_offset,
|
||||
l,n,((int16_t *)&rxdataF[0][(l2*frame_parms->ofdm_symbol_size)+re_offset])[0],
|
||||
((int16_t *)&rxdataF[0][(l2*frame_parms->ofdm_symbol_size)+re_offset])[1]);
|
||||
#endif
|
||||
re_offset++;
|
||||
if (re_offset>= frame_parms->ofdm_symbol_size)
|
||||
re_offset-=frame_parms->ofdm_symbol_size;
|
||||
}
|
||||
}
|
||||
double corr[nr_sequences],corr_re[nr_sequences],corr_im[nr_sequences];
|
||||
memset(corr,0,nr_sequences*sizeof(double));
|
||||
memset(corr_re,0,nr_sequences*sizeof(double));
|
||||
memset(corr_im,0,nr_sequences*sizeof(double));
|
||||
for(i=0;i<nr_sequences;i++){
|
||||
for(l=0;l<pucch_pdu->nr_of_symbols;l++){
|
||||
for(n=0;n<12;n++){
|
||||
corr_re[i]+= (double)(r_re[12*l+n])/32767*(double)(x_n_re[i][12*l+n])/32767+(double)(r_im[12*l+n])/32767*(double)(x_n_im[i][12*l+n])/32767;
|
||||
corr_im[i]+= (double)(r_re[12*l+n])/32767*(double)(x_n_im[i][12*l+n])/32767-(double)(r_im[12*l+n])/32767*(double)(x_n_re[i][12*l+n])/32767;
|
||||
}
|
||||
}
|
||||
corr[i]=corr_re[i]*corr_re[i]+corr_im[i]*corr_im[i];
|
||||
}
|
||||
float max_corr=corr[0];
|
||||
uint8_t index=0;
|
||||
for(i=1;i<nr_sequences;i++){
|
||||
if(corr[i]>max_corr){
|
||||
index= i;
|
||||
max_corr=corr[i];
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
||||
const int16_t *x_re = table_5_2_2_2_2_Re[u],*x_im = table_5_2_2_2_2_Im[u];
|
||||
int16_t xr[24] __attribute__((aligned(32)));
|
||||
//int16_t xrt[24] __attribute__((aligned(32)));
|
||||
int16_t xr[2][24] __attribute__((aligned(32)));
|
||||
int32_t xrtmag=0;
|
||||
uint8_t maxpos=0;
|
||||
int n2=0;
|
||||
uint8_t index=0;
|
||||
memset((void*)xr,0,24*sizeof(int16_t));
|
||||
|
||||
memset((void*)xr[0],0,24*sizeof(int16_t));
|
||||
memset((void*)xr[1],0,24*sizeof(int16_t));
|
||||
int n2;
|
||||
for (l=0; l<pucch_pdu->nr_of_symbols; l++) {
|
||||
|
||||
l2 = l+pucch_pdu->start_symbol_index;
|
||||
re_offset = (12*pucch_pdu->prb_start) + frame_parms->first_carrier_offset;
|
||||
re_offset = (12*prb_offset[l]) + frame_parms->first_carrier_offset;
|
||||
if (re_offset>= frame_parms->ofdm_symbol_size)
|
||||
re_offset-=frame_parms->ofdm_symbol_size;
|
||||
|
||||
AssertFatal(re_offset+12 < frame_parms->ofdm_symbol_size,"pucch straddles DC carrier, handle this!\n");
|
||||
|
||||
int16_t *r=(int16_t*)&rxdataF[0][(l2*frame_parms->ofdm_symbol_size+re_offset)];
|
||||
int16_t *r=(int16_t*)&rxdataF[0][(l2*frame_parms->ofdm_symbol_size)+re_offset];
|
||||
n2=0;
|
||||
for (n=0;n<12;n++,n2+=2) {
|
||||
xr[n2] =(int16_t)(((int32_t)x_re[n]*r[n2]+(int32_t)x_im[n]*r[n2+1])>>15);
|
||||
xr[n2+1]=(int16_t)(((int32_t)x_re[n]*r[n2+1]-(int32_t)x_im[n]*r[n2])>>15);
|
||||
xr[l][n2] =(int16_t)(((int32_t)x_re[l][n]*r[n2]+(int32_t)x_im[l][n]*r[n2+1])>>15);
|
||||
xr[l][n2+1]=(int16_t)(((int32_t)x_re[l][n]*r[n2+1]-(int32_t)x_im[l][n]*r[n2])>>15);
|
||||
#ifdef DEBUG_NR_PUCCH_RX
|
||||
printf("x (%d,%d), r (%d,%d), xr (%d,%d)\n",
|
||||
x_re[n],x_im[n],r[n2],r[n2+1],xr[n2],xr[n2+1]);
|
||||
printf("x (%d,%d), r%d.%d (%d,%d), xr (%d,%d)\n",
|
||||
x_re[l][n],x_im[l][n],l2,re_offset,r[n2],r[n2+1],xr[l][n2],xr[l][n2+1]);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
int32_t corr_re,corr_im,temp,no_corr=0;
|
||||
int32_t corr_re[2],corr_im[2],temp,no_corr=0;
|
||||
int32_t av_corr=0;
|
||||
int seq_index;
|
||||
|
||||
for(i=0;i<nr_sequences;i++){
|
||||
corr_re=0;corr_im=0;
|
||||
n2=0;
|
||||
for (l=0;l<pucch_pdu->nr_of_symbols;l++) {
|
||||
|
||||
corr_re[l]=0;corr_im[l]=0;
|
||||
seq_index = (pucch_pdu->initial_cyclic_shift+
|
||||
mcs[i]+
|
||||
gNB->pucch0_lut.lut[cs_ind][slot][l+pucch_pdu->start_symbol_index])%12;
|
||||
#ifdef DEBUG_NR_PUCCH_RX
|
||||
printf("PUCCH symbol %d seq %d, seq_index %d, mcs %d\n",l,i,seq_index,mcs[i]);
|
||||
#endif
|
||||
n2=0;
|
||||
for (n=0;n<12;n++,n2+=2) {
|
||||
corr_re+=(xr[n2]*idft12_re[seq_index][n]+xr[n2+1]*idft12_im[seq_index][n])>>15;
|
||||
corr_im+=(xr[n2]*idft12_im[seq_index][n]-xr[n2+1]*idft12_re[seq_index][n])>>15;
|
||||
corr_re[l]+=(xr[l][n2]*idft12_re[seq_index][n]+xr[l][n2+1]*idft12_im[seq_index][n])>>15;
|
||||
corr_im[l]+=(xr[l][n2]*idft12_im[seq_index][n]-xr[l][n2+1]*idft12_re[seq_index][n])>>15;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG_NR_PUCCH_RX
|
||||
printf("PUCCH IDFT[%d/%d] = (%d,%d)=>%f\n",mcs[i],seq_index,corr_re,corr_im,10*log10(corr_re*corr_re + corr_im*corr_im));
|
||||
printf("PUCCH IDFT = (%d,%d)=>%f\n",corr_re[0],corr_im[0],10*log10(corr_re[0]*corr_re[0] + corr_im[0]*corr_im[0]));
|
||||
if (l>1) printf("PUCCH 2nd symbol IDFT[%d/%d] = (%d,%d)=>%f\n",mcs[i],seq_index,corr_re[1],corr_im[1],10*log10(corr_re[1]*corr_re[1] + corr_im[1]*corr_im[1]));
|
||||
#endif
|
||||
temp=corr_re*corr_re + corr_im*corr_im;
|
||||
if (pucch_pdu->freq_hop_flag == 0 && l==1) // non-coherent correlation
|
||||
temp=corr_re[0]*corr_re[0] + corr_im[0]*corr_im[0];
|
||||
else if (pucch_pdu->freq_hop_flag == 0 && l==2) {
|
||||
int32_t corr_re2 = corr_re[0]+corr_re[1];
|
||||
int32_t corr_im2 = corr_im[0]+corr_im[1];
|
||||
// coherent combining of 2 symbols and then complex modulus for single-frequency case
|
||||
temp=corr_re2*corr_re2 + corr_im2*corr_im2;
|
||||
}
|
||||
else if (pucch_pdu->freq_hop_flag == 1)
|
||||
// full non-coherent combining of 2 symbols for frequency-hopping case
|
||||
temp = corr_re[0]*corr_re[0] + corr_im[0]*corr_im[0] + corr_re[1]*corr_re[1] + corr_im[1]*corr_im[1];
|
||||
else AssertFatal(1==0,"shouldn't happen\n");
|
||||
|
||||
av_corr+=temp;
|
||||
if (temp>xrtmag) {
|
||||
xrtmag=temp;
|
||||
@@ -366,8 +316,8 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
||||
}
|
||||
}
|
||||
if(nr_sequences>1)
|
||||
no_corr=(av_corr-xrtmag)/(nr_sequences-1);
|
||||
av_corr/=nr_sequences;
|
||||
no_corr=(av_corr-xrtmag)/(nr_sequences-1)/l;
|
||||
av_corr/=nr_sequences/l;
|
||||
|
||||
uint8_t xrtmag_dB = dB_fixed(xrtmag);
|
||||
|
||||
@@ -376,7 +326,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
||||
#endif
|
||||
|
||||
index=maxpos;
|
||||
#endif
|
||||
|
||||
|
||||
// estimate CQI for MAC (from antenna port 0 only)
|
||||
int SNRtimes10 = dB_fixed_times10(signal_energy_nodc(&rxdataF[0][pucch_pdu->start_symbol_index*frame_parms->ofdm_symbol_size+re_offset],12)) - (10*gNB->measurements.n0_power_tot_dB);
|
||||
@@ -414,7 +364,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB,
|
||||
uci_pdu->harq->harq_confidence_level = (no_conf) ? 1 : 0;
|
||||
uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(1);
|
||||
uci_pdu->harq->harq_list[0].harq_value = index&0x01;
|
||||
LOG_D(PHY, "Slot %d HARQ value %d with confidence level (0 is good, 1 is bad) %d\n",
|
||||
LOG_I(PHY, "Slot %d HARQ value %d with confidence level (0 is good, 1 is bad) %d\n",
|
||||
slot,uci_pdu->harq->harq_list[0].harq_value,uci_pdu->harq->harq_confidence_level);
|
||||
if (pucch_pdu->sr_flag == 1) {
|
||||
uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr));
|
||||
|
||||
@@ -716,6 +716,8 @@ int32_t nr_rx_pdcch(PHY_VARS_NR_UE *ue,
|
||||
rel15 = &pdcch_vars->pdcch_config[i];
|
||||
int n_rb,rb_offset;
|
||||
get_coreset_rballoc(rel15->coreset.frequency_domain_resource,&n_rb,&rb_offset);
|
||||
LOG_D(PHY,"pdcch coreset: freq %x, n_rb %d, rb_offset %d\n",
|
||||
rel15->coreset.frequency_domain_resource[0],n_rb,rb_offset);
|
||||
for (int s=rel15->coreset.StartSymbolIndex; s<(rel15->coreset.StartSymbolIndex+rel15->coreset.duration); s++) {
|
||||
LOG_D(PHY,"in nr_pdcch_extract_rbs_single(rxdataF -> rxdataF_ext || dl_ch_estimates -> dl_ch_estimates_ext)\n");
|
||||
|
||||
@@ -916,7 +918,7 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue,
|
||||
currentPtrDCI);
|
||||
|
||||
n_rnti = rel15->rnti;
|
||||
|
||||
LOG_D(PHY, "(%i.%i) dci indication (rnti %x,dci format %d,n_CCE %d,payloadSize %d)\n", proc->frame_rx, proc->nr_slot_rx,n_rnti,rel15->dci_format_options[k],CCEind,dci_length);
|
||||
if (crc == n_rnti) {
|
||||
LOG_D(PHY, "(%i.%i) Received dci indication (rnti %x,dci format %d,n_CCE %d,payloadSize %d,payload %llx)\n",
|
||||
proc->frame_rx, proc->nr_slot_rx,n_rnti,rel15->dci_format_options[k],CCEind,dci_length,*(unsigned long long*)dci_estimation);
|
||||
|
||||
@@ -613,7 +613,7 @@ int nr_rx_pbch( PHY_VARS_NR_UE *ue,
|
||||
uint16_t number_pdus = 1;
|
||||
|
||||
nr_fill_dl_indication(&dl_indication, NULL, &rx_ind, proc, ue, gNB_id);
|
||||
nr_fill_rx_indication(&rx_ind, FAPI_NR_RX_PDU_TYPE_MIB, gNB_id, ue, NULL, number_pdus);
|
||||
nr_fill_rx_indication(&rx_ind, FAPI_NR_RX_PDU_TYPE_SSB, gNB_id, ue, NULL, number_pdus);
|
||||
|
||||
if (ue->if_inst && ue->if_inst->dl_indication)
|
||||
ue->if_inst->dl_indication(&dl_indication, NULL);
|
||||
|
||||
@@ -146,6 +146,9 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
|
||||
get_num_re_dmrs(pusch_pdu, &nb_dmrs_re_per_rb, &number_dmrs_symbols);
|
||||
|
||||
LOG_D(PHY,"ulsch %x : start_rb %d bwp_start %d start_sc %d start_symbol %d num_symbols %d cdmgrpsnodata %d num_dmrs %d dmrs_re_per_rb %d\n",
|
||||
rnti,start_rb,pusch_pdu->bwp_start,start_sc,start_symbol,number_of_symbols,cdm_grps_no_data,number_dmrs_symbols,nb_dmrs_re_per_rb);
|
||||
|
||||
// TbD num_of_mod_symbols is set but never used
|
||||
N_RE_prime = NR_NB_SC_PER_RB*number_of_symbols - nb_dmrs_re_per_rb*number_dmrs_symbols - N_PRB_oh;
|
||||
harq_process_ul_ue->num_of_mod_symbols = N_RE_prime*nb_rb*num_of_codewords;
|
||||
@@ -161,7 +164,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
|
||||
///////////
|
||||
////////////////////////////////////////////////////////////////////
|
||||
log_dump(PHY, harq_process_ul_ue->a, 16, LOG_DUMP_CHAR,"nrue pusch tx frame %d %d: ", frame, slot);
|
||||
//log_dump(PHY, harq_process_ul_ue->a, 16, LOG_DUMP_CHAR,"nrue pusch tx frame %d %d: ", frame, slot);
|
||||
|
||||
/////////////////////////ULSCH scrambling/////////////////////////
|
||||
///////////
|
||||
@@ -362,6 +365,7 @@ void nr_ue_ulsch_procedures(PHY_VARS_NR_UE *UE,
|
||||
|
||||
// TODO: performance improvement, we can skip the modulation of DMRS symbols outside the bandwidth part
|
||||
// Perform this on gold sequence, not required when SC FDMA operation is done,
|
||||
LOG_D(PHY,"DMRS in symbol %d\n",l);
|
||||
nr_modulation(pusch_dmrs[l][0], n_dmrs*2, DMRS_MOD_ORDER, mod_dmrs); // currently only codeword 0 is modulated. Qm = 2 as DMRS is QPSK modulated
|
||||
|
||||
} else {
|
||||
|
||||
@@ -62,7 +62,8 @@ void nr_generate_pucch0(PHY_VARS_NR_UE *ue,
|
||||
uint8_t mcs,
|
||||
uint8_t nrofSymbols,
|
||||
uint8_t startingSymbolIndex,
|
||||
uint16_t startingPRB) {
|
||||
uint16_t startingPRB,
|
||||
uint16_t secondHopPRB) {
|
||||
#ifdef DEBUG_NR_PUCCH_TX
|
||||
printf("\t [nr_generate_pucch0] start function at slot(nr_slot_tx)=%d\n",nr_slot_tx);
|
||||
#endif
|
||||
@@ -94,38 +95,35 @@ void nr_generate_pucch0(PHY_VARS_NR_UE *ue,
|
||||
* x(l*12+n) = r_u_v_alpha_delta(n)
|
||||
*/
|
||||
// the value of u,v (delta always 0 for PUCCH) has to be calculated according to TS 38.211 Subclause 6.3.2.2.1
|
||||
uint8_t u=0,v=0;//,delta=0;
|
||||
// if frequency hopping is disabled by the higher-layer parameter PUCCH-frequency-hopping
|
||||
// n_hop = 0
|
||||
// if frequency hopping is enabled by the higher-layer parameter PUCCH-frequency-hopping
|
||||
// n_hop = 0 for first hop
|
||||
// n_hop = 1 for second hop
|
||||
uint8_t n_hop = 0;
|
||||
//uint8_t PUCCH_Frequency_Hopping; // from higher layers FIXME!!
|
||||
uint8_t u[2]={0,0},v[2]={0,0};
|
||||
|
||||
#ifdef DEBUG_NR_PUCCH_TX
|
||||
printf("\t [nr_generate_pucch0] sequence generation: variable initialization for test\n");
|
||||
#endif
|
||||
// x_n contains the sequence r_u_v_alpha_delta(n)
|
||||
int16_t x_n_re[24],x_n_im[24];
|
||||
int16_t x_n_re[2][24],x_n_im[2][24];
|
||||
|
||||
// we proceed to calculate alpha according to TS 38.211 Subclause 6.3.2.2.2
|
||||
int prb_offset[2]={startingPRB,startingPRB};
|
||||
nr_group_sequence_hopping(pucch_GroupHopping,hoppingId,0,nr_slot_tx,&u[0],&v[0]); // calculating u and v value
|
||||
if (startingPRB!=secondHopPRB) {
|
||||
nr_group_sequence_hopping(pucch_GroupHopping,hoppingId,1,nr_slot_tx,&u[1],&v[1]); // calculating u and v value
|
||||
prb_offset[1] = secondHopPRB;
|
||||
}
|
||||
for (int l=0; l<nrofSymbols; l++) {
|
||||
// if frequency hopping is enabled n_hop = 1 for second hop. Not sure frequency hopping concerns format 0. FIXME!!!
|
||||
// if ((PUCCH_Frequency_Hopping == 1)&&(l == (nrofSymbols-1))) n_hop = 1;
|
||||
nr_group_sequence_hopping(pucch_GroupHopping,hoppingId,n_hop,nr_slot_tx,&u,&v); // calculating u and v value
|
||||
alpha = nr_cyclic_shift_hopping(hoppingId,m0,mcs,l,startingSymbolIndex,nr_slot_tx);
|
||||
#ifdef DEBUG_NR_PUCCH_TX
|
||||
printf("\t [nr_generate_pucch0] sequence generation \tu=%d \tv=%d \talpha=%lf \t(for symbol l=%d)\n",u,v,alpha,l);
|
||||
printf("\t [nr_generate_pucch0] sequence generation \tu=%d \tv=%d \talpha=%lf \t(for symbol l=%d)\n",u[l],v[l],alpha,l);
|
||||
#endif
|
||||
|
||||
for (int n=0; n<12; n++) {
|
||||
x_n_re[(12*l)+n] = (int16_t)(((((int32_t)(round(32767*cos(alpha*n))) * table_5_2_2_2_2_Re[u][n])>>15)
|
||||
- (((int32_t)(round(32767*sin(alpha*n))) * table_5_2_2_2_2_Im[u][n])>>15))); // Re part of base sequence shifted by alpha
|
||||
x_n_im[(12*l)+n] = (int16_t)(((((int32_t)(round(32767*cos(alpha*n))) * table_5_2_2_2_2_Im[u][n])>>15)
|
||||
+ (((int32_t)(round(32767*sin(alpha*n))) * table_5_2_2_2_2_Re[u][n])>>15))); // Im part of base sequence shifted by alpha
|
||||
x_n_re[l][n] = (int16_t)(((((int32_t)(round(32767*cos(alpha*n))) * table_5_2_2_2_2_Re[u[l]][n])>>15)
|
||||
- (((int32_t)(round(32767*sin(alpha*n))) * table_5_2_2_2_2_Im[u[l]][n])>>15))); // Re part of base sequence shifted by alpha
|
||||
x_n_im[l][n] = (int16_t)(((((int32_t)(round(32767*cos(alpha*n))) * table_5_2_2_2_2_Im[u[l]][n])>>15)
|
||||
+ (((int32_t)(round(32767*sin(alpha*n))) * table_5_2_2_2_2_Re[u[l]][n])>>15))); // Im part of base sequence shifted by alpha
|
||||
#ifdef DEBUG_NR_PUCCH_TX
|
||||
printf("\t [nr_generate_pucch0] sequence generation \tu=%d \tv=%d \talpha=%lf \tx_n(l=%d,n=%d)=(%d,%d)\n",
|
||||
u,v,alpha,l,n,x_n_re[(12*l)+n],x_n_im[(12*l)+n]);
|
||||
u[l],v[l],alpha,l,n,x_n_re[l][n],x_n_im[l][n]);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -139,15 +137,18 @@ void nr_generate_pucch0(PHY_VARS_NR_UE *ue,
|
||||
|
||||
for (int l=0; l<nrofSymbols; l++) {
|
||||
l2=l+startingSymbolIndex;
|
||||
re_offset = (12*startingPRB) + frame_parms->first_carrier_offset;
|
||||
re_offset = (12*prb_offset[l]) + frame_parms->first_carrier_offset;
|
||||
if (re_offset>= frame_parms->ofdm_symbol_size)
|
||||
re_offset-=frame_parms->ofdm_symbol_size;
|
||||
|
||||
//txptr = &txdataF[0][re_offset];
|
||||
#ifdef DEBUG_NR_PUCCH_TX
|
||||
printf("\t [nr_generate_pucch0] symbol %d PRB %d (%d)\n",l,prb_offset[l],re_offset);
|
||||
#endif
|
||||
for (int n=0; n<12; n++) {
|
||||
|
||||
((int16_t *)&txdataF[0][(l2*frame_parms->ofdm_symbol_size) + re_offset])[0] = (int16_t)(((int32_t)(amp) * x_n_re[(12*l)+n])>>15);
|
||||
((int16_t *)&txdataF[0][(l2*frame_parms->ofdm_symbol_size) + re_offset])[1] = (int16_t)(((int32_t)(amp) * x_n_im[(12*l)+n])>>15);
|
||||
((int16_t *)&txdataF[0][(l2*frame_parms->ofdm_symbol_size) + re_offset])[0] = (int16_t)(((int32_t)(amp) * x_n_re[l][n])>>15);
|
||||
((int16_t *)&txdataF[0][(l2*frame_parms->ofdm_symbol_size) + re_offset])[1] = (int16_t)(((int32_t)(amp) * x_n_im[l][n])>>15);
|
||||
//((int16_t *)txptr[0][re_offset])[0] = (int16_t)((int32_t)amp * x_n_re[(12*l)+n])>>15;
|
||||
//((int16_t *)txptr[0][re_offset])[1] = (int16_t)((int32_t)amp * x_n_im[(12*l)+n])>>15;
|
||||
//txptr[re_offset] = (x_n_re[(12*l)+n]<<16) + x_n_im[(12*l)+n];
|
||||
|
||||
@@ -57,7 +57,8 @@ void nr_generate_pucch0(PHY_VARS_NR_UE *ue,
|
||||
uint8_t mcs,
|
||||
uint8_t nrofSymbols,
|
||||
uint8_t startingSymbolIndex,
|
||||
uint16_t startingPRB);
|
||||
uint16_t startingPRB,
|
||||
uint16_t secondHopPRB);
|
||||
void nr_generate_pucch1(PHY_VARS_NR_UE *ue,
|
||||
int32_t **txdataF,
|
||||
NR_DL_FRAME_PARMS *frame_parms,
|
||||
|
||||
@@ -104,7 +104,7 @@ void handle_nfapi_nr_pdcch_pdu(PHY_VARS_gNB *gNB,
|
||||
int frame, int slot,
|
||||
nfapi_nr_dl_tti_pdcch_pdu *pdcch_pdu) {
|
||||
|
||||
LOG_D(PHY,"Frame %d, Slot %d: DCI processing - proc:slot_tx:%d pdcch_pdu_rel15->numDlDci:%d\n",frame,slot, slot, pdcch_pdu->pdcch_pdu_rel15.numDlDci);
|
||||
LOG_I(PHY,"Frame %d, Slot %d: DCI processing - proc:slot_tx:%d pdcch_pdu_rel15->numDlDci:%d\n",frame,slot, slot, pdcch_pdu->pdcch_pdu_rel15.numDlDci);
|
||||
|
||||
// copy dci configuration into gNB structure
|
||||
// gNB->pdcch_pdu = pdcch_pdu;
|
||||
@@ -119,7 +119,7 @@ void handle_nfapi_nr_ul_dci_pdu(PHY_VARS_gNB *gNB,
|
||||
int frame, int slot,
|
||||
nfapi_nr_ul_dci_request_pdus_t *ul_dci_request_pdu) {
|
||||
|
||||
LOG_D(PHY,"Frame %d, Slot %d: UL DCI processing - proc:slot_tx:%d pdcch_pdu_rel15->numDlDci:%d\n",frame,slot, slot, ul_dci_request_pdu->pdcch_pdu.pdcch_pdu_rel15.numDlDci);
|
||||
LOG_I(PHY,"Frame %d, Slot %d: UL DCI processing - proc:slot_tx:%d pdcch_pdu_rel15->numDlDci:%d\n",frame,slot, slot, ul_dci_request_pdu->pdcch_pdu.pdcch_pdu_rel15.numDlDci);
|
||||
|
||||
// copy dci configuration into gNB structure
|
||||
// gNB->ul_dci_pdu = ul_dci_request_pdu;
|
||||
|
||||
@@ -313,7 +313,7 @@ void nr_ulsch_procedures(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx, int ULSCH
|
||||
number_dmrs_symbols, // number of dmrs symbols irrespective of single or double symbol dmrs
|
||||
pusch_pdu->qam_mod_order,
|
||||
pusch_pdu->nrOfLayers);
|
||||
LOG_D(PHY,"rb_size %d, number_symbols %d, nb_re_dmrs %d, number_dmrs_symbols %d, qam_mod_order %d, nrOfLayer %d\n",
|
||||
LOG_I(PHY,"rb_size %d, number_symbols %d, nb_re_dmrs %d, number_dmrs_symbols %d, qam_mod_order %d, nrOfLayer %d\n",
|
||||
pusch_pdu->rb_size,
|
||||
number_symbols,
|
||||
nb_re_dmrs,
|
||||
|
||||
@@ -139,12 +139,13 @@ void nr_fill_rx_indication(fapi_nr_rx_indication_t *rx_ind,
|
||||
rx_ind->rx_indication_body[n_pdus - 1].pdsch_pdu.pdu = dlsch0->harq_processes[harq_pid]->b;
|
||||
rx_ind->rx_indication_body[n_pdus - 1].pdsch_pdu.pdu_length = dlsch0->harq_processes[harq_pid]->TBS / 8;
|
||||
break;
|
||||
case FAPI_NR_RX_PDU_TYPE_MIB:
|
||||
rx_ind->rx_indication_body[n_pdus - 1].mib_pdu.pdu = ue->pbch_vars[gNB_id]->decoded_output;
|
||||
rx_ind->rx_indication_body[n_pdus - 1].mib_pdu.additional_bits = ue->pbch_vars[gNB_id]->xtra_byte;
|
||||
rx_ind->rx_indication_body[n_pdus - 1].mib_pdu.ssb_index = frame_parms->ssb_index;
|
||||
rx_ind->rx_indication_body[n_pdus - 1].mib_pdu.ssb_length = frame_parms->Lmax;
|
||||
rx_ind->rx_indication_body[n_pdus - 1].mib_pdu.cell_id = frame_parms->Nid_cell;
|
||||
case FAPI_NR_RX_PDU_TYPE_SSB:
|
||||
rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.pdu = ue->pbch_vars[gNB_id]->decoded_output;
|
||||
rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.additional_bits = ue->pbch_vars[gNB_id]->xtra_byte;
|
||||
rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.ssb_index = frame_parms->ssb_index;
|
||||
rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.ssb_length = frame_parms->Lmax;
|
||||
rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.cell_id = frame_parms->Nid_cell;
|
||||
rx_ind->rx_indication_body[n_pdus - 1].ssb_pdu.ssb_start_subcarrier = frame_parms->ssb_start_subcarrier;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -291,7 +292,7 @@ void phy_procedures_nrUE_TX(PHY_VARS_NR_UE *ue,
|
||||
if (ue->UE_mode[gNB_id] > NOT_SYNCHED && ue->UE_mode[gNB_id] < PUSCH) {
|
||||
nr_ue_prach_procedures(ue, proc, gNB_id);
|
||||
}
|
||||
LOG_I(PHY,"****** end TX-Chain (%s) for AbsSubframe %d.%d ******\n", nr_mode_string[ue->UE_mode[gNB_id]],frame_tx, slot_tx);
|
||||
LOG_D(PHY,"****** end TX-Chain (%s) for AbsSubframe %d.%d ******\n", nr_mode_string[ue->UE_mode[gNB_id]],frame_tx, slot_tx);
|
||||
|
||||
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX, VCD_FUNCTION_OUT);
|
||||
#if UE_TIMING_TRACE
|
||||
@@ -2065,7 +2066,7 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t
|
||||
|
||||
|
||||
nr_prach = nr_ue_get_rach(prach_resources, &ue->prach_vars[0]->prach_pdu, mod_id, ue->CC_id, frame_tx, gNB_id, nr_slot_tx);
|
||||
LOG_I(PHY, "In %s:[%d.%d] getting PRACH resources : %d\n", __FUNCTION__, frame_tx, nr_slot_tx,nr_prach);
|
||||
LOG_D(PHY, "In %s:[%d.%d] getting PRACH resources : %d\n", __FUNCTION__, frame_tx, nr_slot_tx,nr_prach);
|
||||
}
|
||||
|
||||
if (nr_prach == GENERATE_PREAMBLE) {
|
||||
@@ -2075,7 +2076,7 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t
|
||||
int16_t ra_preamble_rx_power = (int16_t)(prach_resources->ra_PREAMBLE_RECEIVED_TARGET_POWER - pathloss + 30);
|
||||
ue->tx_power_dBm[nr_slot_tx] = min(nr_get_Pcmax(mod_id), ra_preamble_rx_power);
|
||||
|
||||
LOG_I(PHY,"DEBUG [UE %d][RAPROC][%d.%d]: Generating PRACH Msg1 (preamble %d, PL %d dB, P0_PRACH %d, TARGET_RECEIVED_POWER %d dBm, RA-RNTI %x)\n",
|
||||
LOG_D(PHY,"DEBUG [UE %d][RAPROC][%d.%d]: Generating PRACH Msg1 (preamble %d, PL %d dB, P0_PRACH %d, TARGET_RECEIVED_POWER %d dBm, RA-RNTI %x)\n",
|
||||
mod_id,
|
||||
frame_tx,
|
||||
nr_slot_tx,
|
||||
|
||||
@@ -236,7 +236,6 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
|
||||
|
||||
/* update current context */
|
||||
|
||||
if (!mac->cg) return(TRUE);
|
||||
|
||||
int subframe_number = proc->nr_slot_rx / ue->frame_parms.slots_per_subframe;
|
||||
nb_pucch_format_4_in_subframes[subframe_number] = 0; /* reset pucch format 4 counter at current rx position */
|
||||
@@ -248,7 +247,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
|
||||
pucch_resource_indicator = ue->dlsch[proc->thread_id][gNB_id][0]->harq_processes[dl_harq_pid]->harq_ack.pucch_resource_indicator;
|
||||
}
|
||||
|
||||
LOG_D(PHY, "PUCCH: %d.%d dl_harq_pid = %d, pucch_resource_indicator = %d\n", frame_tx, nr_slot_tx, dl_harq_pid, pucch_resource_indicator);
|
||||
LOG_D(PHY, "PUCCH: %d.%d bwp_id %d dl_harq_pid = %d, pucch_resource_indicator = %d\n", frame_tx, nr_slot_tx, bwp_id,dl_harq_pid, pucch_resource_indicator);
|
||||
|
||||
/* Part - I
|
||||
* Collect feedback that should be transmitted at this nr_slot_tx :
|
||||
@@ -283,61 +282,68 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
|
||||
ri_status = ((ue->cqi_report_config[gNB_id].CQI_ReportPeriodic.ri_ConfigIndex>0) &&
|
||||
(nr_is_ri_TXOp(ue,proc,gNB_id) == 1));
|
||||
|
||||
|
||||
NR_CSI_MeasConfig_t *csi_MeasConfig = mac->cg->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup;
|
||||
|
||||
uint16_t report_slot_csi =csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320;
|
||||
|
||||
//if (mac->csirc->reportQuantity.choice.ssb_Index_RSRP){
|
||||
if (report_slot_csi == proc->nr_slot_tx)
|
||||
csi_status = get_csi_nr(mac, ue, gNB_id, &csi_payload);
|
||||
else
|
||||
csi_status = 0;
|
||||
//}
|
||||
|
||||
O_CSI = cqi_status + ri_status + csi_status;
|
||||
|
||||
/* Part - II */
|
||||
/* if payload is empty or only negative SR -> no pucch transmission */
|
||||
|
||||
if(O_ACK == 0) {
|
||||
N_UCI = O_SR + O_CSI;
|
||||
if ((N_UCI == 0) || ((O_CSI == 0) && (sr_payload == 0))) { /* TS 38.213 9.2.4 UE procedure for reporting SR */
|
||||
NR_TST_PHY_PRINTF("PUCCH No feedback AbsSubframe %d.%d \n", frame_tx%1024, nr_slot_tx);
|
||||
LOG_D(PHY,"PUCCH No feedback AbsSubframe %d.%d \n", frame_tx%1024, nr_slot_tx);
|
||||
return (FALSE);
|
||||
}
|
||||
else {
|
||||
/* a resource set and a resource should be find according to payload size */
|
||||
pucch_resource_set = find_pucch_resource_set( mac, gNB_id, N_UCI);
|
||||
if (pucch_resource_set != MAX_NB_OF_PUCCH_RESOURCE_SETS) {
|
||||
pucch_resource_indicator = 0;
|
||||
pucch_resource_id = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[pucch_resource_set]->resourceList.list.array[pucch_resource_indicator][0]; /* get the first resource of the set */
|
||||
if (mac->cg &&
|
||||
mac->cg->spCellConfig &&
|
||||
mac->cg->spCellConfig->spCellConfigDedicated &&
|
||||
mac->cg->spCellConfig->spCellConfigDedicated->csi_MeasConfig&&
|
||||
mac->cg->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup) {
|
||||
NR_CSI_MeasConfig_t *csi_MeasConfig = mac->cg->spCellConfig->spCellConfigDedicated->csi_MeasConfig->choice.setup;
|
||||
|
||||
uint16_t report_slot_csi =csi_MeasConfig->csi_ReportConfigToAddModList->list.array[0]->reportConfigType.choice.periodic->reportSlotConfig.choice.slots320;
|
||||
|
||||
//if (mac->csirc->reportQuantity.choice.ssb_Index_RSRP){
|
||||
if (report_slot_csi == proc->nr_slot_tx)
|
||||
csi_status = get_csi_nr(mac, ue, gNB_id, &csi_payload);
|
||||
else
|
||||
csi_status = 0;
|
||||
//}
|
||||
|
||||
O_CSI = cqi_status + ri_status + csi_status;
|
||||
|
||||
/* Part - II */
|
||||
/* if payload is empty or only negative SR -> no pucch transmission */
|
||||
|
||||
if(O_ACK == 0) {
|
||||
N_UCI = O_SR + O_CSI;
|
||||
if ((N_UCI == 0) || ((O_CSI == 0) && (sr_payload == 0))) { /* TS 38.213 9.2.4 UE procedure for reporting SR */
|
||||
NR_TST_PHY_PRINTF("PUCCH No feedback AbsSubframe %d.%d \n", frame_tx%1024, nr_slot_tx);
|
||||
LOG_D(PHY,"PUCCH No feedback AbsSubframe %d.%d \n", frame_tx%1024, nr_slot_tx);
|
||||
return (FALSE);
|
||||
}
|
||||
else {
|
||||
LOG_W(PHY,"PUCCH no resource set found for CSI at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
|
||||
O_CSI = 0;
|
||||
csi_payload = 0;
|
||||
}
|
||||
|
||||
if (O_CSI == 0) {
|
||||
/* only SR has to be send */
|
||||
/* in this case there is no DCI related to PUCCH parameters so pucch resource should be get from sr configuration */
|
||||
/* TS 38.213 9.2.4 UE procedure for reporting SR */
|
||||
pucch_resource_set = 0; /* force it to a valid value */
|
||||
if (ue->scheduling_request_config_nr[gNB_id].sr_ResourceConfig[ue->scheduling_request_config_nr[gNB_id].active_sr_id] != NULL) {
|
||||
pucch_resource_id = ue->scheduling_request_config_nr[gNB_id].sr_ResourceConfig[ue->scheduling_request_config_nr[gNB_id].active_sr_id]->resource;
|
||||
}
|
||||
else {
|
||||
LOG_E(PHY,"PUCCH No scheduling request configuration : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
|
||||
return(FALSE);
|
||||
}
|
||||
/* a resource set and a resource should be find according to payload size */
|
||||
pucch_resource_set = find_pucch_resource_set( mac, gNB_id, N_UCI);
|
||||
if (pucch_resource_set != MAX_NB_OF_PUCCH_RESOURCE_SETS) {
|
||||
pucch_resource_indicator = 0;
|
||||
pucch_resource_id = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[pucch_resource_set]->resourceList.list.array[pucch_resource_indicator][0]; /* get the first resource of the set */
|
||||
}
|
||||
else {
|
||||
LOG_W(PHY,"PUCCH no resource set found for CSI at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
|
||||
O_CSI = 0;
|
||||
csi_payload = 0;
|
||||
}
|
||||
|
||||
if (O_CSI == 0) {
|
||||
/* only SR has to be send */
|
||||
/* in this case there is no DCI related to PUCCH parameters so pucch resource should be get from sr configuration */
|
||||
/* TS 38.213 9.2.4 UE procedure for reporting SR */
|
||||
pucch_resource_set = 0; /* force it to a valid value */
|
||||
if (ue->scheduling_request_config_nr[gNB_id].sr_ResourceConfig[ue->scheduling_request_config_nr[gNB_id].active_sr_id] != NULL) {
|
||||
pucch_resource_id = ue->scheduling_request_config_nr[gNB_id].sr_ResourceConfig[ue->scheduling_request_config_nr[gNB_id].active_sr_id]->resource;
|
||||
}
|
||||
else {
|
||||
LOG_E(PHY,"PUCCH No scheduling request configuration : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
|
||||
return(FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
N_UCI = O_SR + O_ACK + O_CSI;
|
||||
}
|
||||
|
||||
|
||||
N_UCI = O_SR + O_ACK + O_CSI;
|
||||
if (N_UCI ==0) return(TRUE);
|
||||
|
||||
/* Part - III */
|
||||
/* Choice PUCCH format and its related parameters */
|
||||
@@ -345,8 +351,8 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
|
||||
uint8_t starting_symbol_index=0;
|
||||
uint8_t nb_symbols_total = 0;
|
||||
uint8_t nb_symbols = 0;
|
||||
uint16_t starting_prb = 0;; /* it can be considered as first hop on case of pucch hopping */
|
||||
uint16_t second_hop = 0; /* second part for pucch for hopping */
|
||||
uint16_t startingPRB = 0;; /* it can be considered as first hop on case of pucch hopping */
|
||||
uint16_t secondHopPRB = 0; /* second part for pucch for hopping */
|
||||
uint8_t nb_of_prbs = 0;
|
||||
int m_0 = 0; /* format 0 only */
|
||||
int m_CS = 0; /* for all format except for format 0 */
|
||||
@@ -363,29 +369,32 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
|
||||
/* use of initial pucch configuration provided by system information 1 */
|
||||
/***********************************************************************/
|
||||
if (initial_pucch_id != NB_INITIAL_PUCCH_RESOURCE) {
|
||||
LOG_I(MAC,"Selecting INITIAL PUCCH Resource\n");
|
||||
format = initial_pucch_resource[initial_pucch_id].format;
|
||||
starting_symbol_index = initial_pucch_resource[initial_pucch_id].startingSymbolIndex;
|
||||
nb_symbols_total = initial_pucch_resource[initial_pucch_id].nrofSymbols;
|
||||
|
||||
int N_CS = initial_pucch_resource[initial_pucch_id].nb_CS_indexes;
|
||||
/* see TS 38213 Table 9.2.1-1: PUCCH resource sets before dedicated PUCCH resource configuration */
|
||||
int BWPsize = NRRIV2BW(mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.locationAndBandwidth,
|
||||
MAX_BWP_SIZE);
|
||||
int RB_BWP_offset;
|
||||
if (initial_pucch_id == 15) {
|
||||
RB_BWP_offset = ue->systemInformationBlockType1_nr.N_BWP_SIZE/4;
|
||||
RB_BWP_offset =BWPsize/4;
|
||||
}
|
||||
else
|
||||
{
|
||||
RB_BWP_offset = initial_pucch_resource[initial_pucch_id].PRB_offset;
|
||||
}
|
||||
if (initial_pucch_id/8 == 0) {
|
||||
starting_prb = RB_BWP_offset + (initial_pucch_id/N_CS);
|
||||
second_hop = ue->systemInformationBlockType1_nr.N_BWP_SIZE - 1 - RB_BWP_offset - (initial_pucch_id/N_CS);
|
||||
startingPRB = RB_BWP_offset + (initial_pucch_id/N_CS);
|
||||
secondHopPRB = BWPsize - 1 - RB_BWP_offset - (initial_pucch_id/N_CS);
|
||||
m_0 = initial_pucch_resource[initial_pucch_id].initial_CS_indexes[initial_pucch_id%N_CS];
|
||||
}
|
||||
else if (initial_pucch_id/8 == 1)
|
||||
{
|
||||
starting_prb = RB_BWP_offset + (initial_pucch_id/N_CS);
|
||||
second_hop = ue->systemInformationBlockType1_nr.N_BWP_SIZE - 1 - RB_BWP_offset - ((initial_pucch_id - 8)/N_CS);
|
||||
startingPRB = RB_BWP_offset + (initial_pucch_id/N_CS);
|
||||
secondHopPRB = BWPsize - 1 - RB_BWP_offset - ((initial_pucch_id - 8)/N_CS);
|
||||
m_0 = initial_pucch_resource[initial_pucch_id].initial_CS_indexes[(initial_pucch_id - 8)%N_CS];
|
||||
}
|
||||
if ((ue->UE_mode[gNB_id] != PUSCH) && (O_ACK > 1)) {
|
||||
@@ -412,8 +421,8 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
|
||||
format = pucch_resource->format.present;
|
||||
nb_symbols_total = get_nb_symbols_pucch(pucch_resource, format);
|
||||
starting_symbol_index = get_starting_symb_idx(pucch_resource, format);
|
||||
starting_prb = pucch_resource->startingPRB;
|
||||
second_hop = starting_prb;
|
||||
startingPRB = pucch_resource->startingPRB;
|
||||
secondHopPRB = pucch_resource->intraSlotFrequencyHopping ? pucch_resource->secondHopPRB : startingPRB;
|
||||
if (format==pucch_format1_nr)
|
||||
time_domain_occ = pucch_resource->format.choice.format1->timeDomainOCC;
|
||||
if (format==pucch_format4_nr) {
|
||||
@@ -454,7 +463,9 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
|
||||
int O_CRC = 0;
|
||||
|
||||
nb_symbols = nb_symbols_total; /* by default, it can be reduced due to symbols reserved for dmrs */
|
||||
pucch_resource = mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceToAddModList->list.array[pucch_resource_id];
|
||||
pucch_resource = format>1 ?
|
||||
mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceToAddModList->list.array[pucch_resource_id]:
|
||||
0;
|
||||
|
||||
switch(format) {
|
||||
case pucch_format0_nr:
|
||||
@@ -602,8 +613,8 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
|
||||
NR_TST_PHY_PRINTF("PUCCH ( format : %d ) ( modulation : %s ) ( nb prb : %d ) ( nb symbols total: %d ) ( nb symbols : %d ) ( max code rate*100 : %d ) ( starting_symbol_index : %d ) \n",
|
||||
format, (Q_m == BITS_PER_SYMBOL_QPSK ? " QPSK " : " BPSK "), nb_of_prbs, nb_symbols_total, nb_symbols, max_code_rate, starting_symbol_index);
|
||||
|
||||
NR_TST_PHY_PRINTF("PUCCH ( starting_prb : %d ) ( second_hop : %d ) ( m_0 : %d ) ( m_CS : %d ) ( time_domain_occ %d ) (occ_length : %d ) ( occ_Index : %d ) \n",
|
||||
starting_prb, second_hop, m_0, m_CS, time_domain_occ, occ_length, occ_Index);
|
||||
NR_TST_PHY_PRINTF("PUCCH ( startingPRB : %d ) ( secondHopPRB : %d ) ( m_0 : %d ) ( m_CS : %d ) ( time_domain_occ %d ) (occ_length : %d ) ( occ_Index : %d ) \n",
|
||||
startingPRB, secondHopPRB, m_0, m_CS, time_domain_occ, occ_length, occ_Index);
|
||||
|
||||
/* Part - IV */
|
||||
/* Generate PUCCH signal according to its format and parameters */
|
||||
@@ -632,17 +643,27 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
|
||||
switch(format) {
|
||||
case pucch_format0_nr:
|
||||
{
|
||||
int pucch_GroupHopping = mac->ULbwp[bwp_id-1] ?
|
||||
mac->ULbwp[bwp_id-1]->bwp_Common->pucch_ConfigCommon->choice.setup->pucch_GroupHopping:
|
||||
mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pucch_ConfigCommon->choice.setup->pucch_GroupHopping;
|
||||
int hoppingId = mac->ULbwp[bwp_id-1] ?
|
||||
mac->ULbwp[bwp_id-1]->bwp_Common->pucch_ConfigCommon->choice.setup->hoppingId[0]:
|
||||
(mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pucch_ConfigCommon->choice.setup->hoppingId?
|
||||
mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pucch_ConfigCommon->choice.setup->hoppingId[0]:
|
||||
mac->physCellId);
|
||||
nr_generate_pucch0(ue,ue->common_vars.txdataF,
|
||||
&ue->frame_parms,
|
||||
mac->ULbwp[bwp_id-1]->bwp_Common->pucch_ConfigCommon->choice.setup->pucch_GroupHopping,
|
||||
mac->ULbwp[bwp_id-1]->bwp_Common->pucch_ConfigCommon->choice.setup->hoppingId[0],
|
||||
tx_amp,
|
||||
nr_slot_tx,
|
||||
(uint8_t)m_0,
|
||||
(uint8_t)m_CS,
|
||||
nb_symbols_total,
|
||||
starting_symbol_index,
|
||||
starting_prb);
|
||||
&ue->frame_parms,
|
||||
pucch_GroupHopping,
|
||||
hoppingId,
|
||||
tx_amp,
|
||||
nr_slot_tx,
|
||||
(uint8_t)m_0,
|
||||
(uint8_t)m_CS,
|
||||
nb_symbols_total,
|
||||
starting_symbol_index,
|
||||
startingPRB,
|
||||
secondHopPRB
|
||||
);
|
||||
break;
|
||||
}
|
||||
case pucch_format1_nr:
|
||||
@@ -656,8 +677,8 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
|
||||
(uint8_t)m_0,
|
||||
nb_symbols_total,
|
||||
starting_symbol_index,
|
||||
starting_prb,
|
||||
second_hop,
|
||||
startingPRB,
|
||||
secondHopPRB,
|
||||
(uint8_t)time_domain_occ,
|
||||
(uint8_t)N_UCI);
|
||||
break;
|
||||
@@ -677,7 +698,7 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
|
||||
nb_symbols_total,
|
||||
starting_symbol_index,
|
||||
nb_of_prbs,
|
||||
starting_prb,
|
||||
startingPRB,
|
||||
(uint8_t)N_UCI);
|
||||
break;
|
||||
}
|
||||
@@ -696,8 +717,8 @@ bool pucch_procedures_ue_nr(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_
|
||||
nb_symbols_total,
|
||||
starting_symbol_index,
|
||||
nb_of_prbs,
|
||||
starting_prb,
|
||||
second_hop,
|
||||
startingPRB,
|
||||
secondHopPRB,
|
||||
(uint8_t)N_UCI,
|
||||
(uint8_t)occ_length,
|
||||
(uint8_t)occ_Index);
|
||||
@@ -753,9 +774,13 @@ uint8_t get_downlink_ack(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_t
|
||||
int V_DAI_m_DL = 0;
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(0);
|
||||
|
||||
if (mac->DLbwp[0] == NULL) return 0;
|
||||
|
||||
if (mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI[0] == 2) {
|
||||
|
||||
if (mac->DLbwp[0] &&
|
||||
mac->DLbwp[0]->bwp_Dedicated &&
|
||||
mac->DLbwp[0]->bwp_Dedicated->pdsch_Config &&
|
||||
mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup &&
|
||||
mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI[0] == 2) {
|
||||
two_transport_blocks = TRUE;
|
||||
number_of_code_word = 2;
|
||||
}
|
||||
@@ -832,7 +857,9 @@ uint8_t get_downlink_ack(PHY_VARS_NR_UE *ue, uint8_t gNB_id, UE_nr_rxtx_proc_t
|
||||
U_DAI_c = number_harq_feedback/number_of_code_word;
|
||||
N_m_c_rx = number_harq_feedback;
|
||||
int N_SPS_c = 0; /* FFS TODO_NR multicells and SPS are not supported at the moment */
|
||||
if (mac->cg->physicalCellGroupConfig->harq_ACK_SpatialBundlingPUCCH == NULL) {
|
||||
if (mac->cg != NULL &&
|
||||
mac->cg->physicalCellGroupConfig != NULL &&
|
||||
mac->cg->physicalCellGroupConfig->harq_ACK_SpatialBundlingPUCCH != NULL) {
|
||||
int N_TB_max_DL = mac->DLbwp[0]->bwp_Dedicated->pdsch_Config->choice.setup->maxNrofCodeWordsScheduledByDCI[0];
|
||||
*n_HARQ_ACK = (((V_DAI_m_DL - U_DAI_c)%4) * N_TB_max_DL) + N_m_c_rx + N_SPS_c;
|
||||
NR_TST_PHY_PRINTF("PUCCH power n(%d) = ( V(%d) - U(%d) )mod4 * N_TB(%d) + N(%d) \n", *n_HARQ_ACK, V_DAI_m_DL, U_DAI_c, N_TB_max_DL, N_m_c_rx);
|
||||
@@ -945,12 +972,19 @@ boolean_t select_pucch_resource(PHY_VARS_NR_UE *ue, NR_UE_MAC_INST_t *mac, uint8
|
||||
//*resource_set_id = MAX_NB_OF_PUCCH_RESOURCE_SETS;
|
||||
//*resource_id = MAX_NB_OF_PUCCH_RESOURCES;
|
||||
|
||||
if (mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[0] == NULL) {
|
||||
if (bwp_id == 0 ||
|
||||
(mac->ULbwp[bwp_id-1] &&
|
||||
mac->ULbwp[bwp_id-1]->bwp_Dedicated &&
|
||||
mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config &&
|
||||
mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup &&
|
||||
mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList &&
|
||||
mac->ULbwp[bwp_id-1]->bwp_Dedicated->pucch_Config->choice.setup->resourceSetToAddModList->list.array[0] == NULL)
|
||||
){
|
||||
|
||||
/* No resource set has been already configured so pucch_configCommon from Sib1 should be used in this case */
|
||||
|
||||
if (ue->UE_mode[gNB_id] != PUSCH) {
|
||||
*initial_pucch_id = mac->ULbwp[bwp_id-1]->bwp_Common->pucch_ConfigCommon->choice.setup->pucch_ResourceCommon[0];
|
||||
*initial_pucch_id = *mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pucch_ConfigCommon->choice.setup->pucch_ResourceCommon;
|
||||
if (*initial_pucch_id >= NB_INITIAL_PUCCH_RESOURCE) {
|
||||
LOG_E(PHY,"PUCCH Invalid initial resource index : at line %d in function %s of file %s \n", LINE_FILE , __func__, FILE_NAME);
|
||||
*initial_pucch_id = NB_INITIAL_PUCCH_RESOURCE;
|
||||
|
||||
@@ -398,7 +398,7 @@
|
||||
{GNB_CONFIG_STRING_PUCCHGROUPHOPPING, NULL,0,i64ptr:&scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->pucch_GroupHopping,defint64val:NR_PUCCH_ConfigCommon__pucch_GroupHopping_neither,TYPE_INT64,0},\
|
||||
{GNB_CONFIG_STRING_HOPPINGID, NULL,0,i64ptr:scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->hoppingId,defint64val:40,TYPE_INT64,0},\
|
||||
{GNB_CONFIG_STRING_P0NOMINAL, NULL,0,i64ptr:scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->p0_nominal,defint64val:1,TYPE_INT64,0},\
|
||||
{GNB_CONFIG_STRING_PUCCHRES, NULL,0,i64ptr:scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->pucch_ResoureCommon,defint64val:0,TYPE_INT64,0},\
|
||||
{GNB_CONFIG_STRING_PUCCHRES, NULL,0,i64ptr:scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->pucch_ResourceCommon,defint64val:0,TYPE_INT64,0},\
|
||||
{GNB_CONFIG_STRING_SSBPOSITIONSINBURSTPR,NULL,0,uptr:&scc->ssb_PositionsInBurst->present,defuintval:NR_ServingCellConfigCommon__ssb_PositionsInBurst_PR_mediumBitmap,TYPE_UINT,0/*140*/}, \
|
||||
{GNB_CONFIG_STRING_SSBPOSITIONSINBURST,NULL,0,u64ptr:&ssb_bitmap,defintval:0xff,TYPE_UINT64,0}, \
|
||||
{GNB_CONFIG_STRING_REFERENCESUBCARRIERSPACING,NULL,0,i64ptr:&scc->tdd_UL_DL_ConfigurationCommon->referenceSubcarrierSpacing,defint64val:NR_SubcarrierSpacing_kHz30,TYPE_INT64,0},\
|
||||
|
||||
@@ -299,7 +299,7 @@ void fix_scc(NR_ServingCellConfigCommon_t *scc,uint64_t ssbmap) {
|
||||
}
|
||||
|
||||
// check pucch_ResourceConfig
|
||||
AssertFatal(scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->pucch_ResourceConfig < 2,
|
||||
AssertFatal(*scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->pucch_ResourceCommon < 2,
|
||||
"pucch_ResourceConfig should be 0 or 1 for now\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -2729,7 +2729,6 @@ uint16_t nr_dci_size(const NR_BWP_UplinkCommon_t *initialUplinkBWP,
|
||||
dci_pdu->frequency_domain_assignment.nbits = (int)ceil( log2( (N_RB*(N_RB+1))>>1 ) );
|
||||
dci_pdu->time_domain_assignment.nbits = 4;
|
||||
dci_pdu->vrb_to_prb_mapping.nbits = 1;
|
||||
|
||||
break;
|
||||
|
||||
case NR_DL_DCI_FORMAT_1_1:
|
||||
|
||||
@@ -735,10 +735,11 @@ int nr_rrc_mac_config_req_ue(
|
||||
build_ssb_to_ro_map(mac);
|
||||
}
|
||||
else if (cell_group_config != NULL ){
|
||||
LOG_I(MAC,"Applying CellGroupConfig from gNodeB\n");
|
||||
mac->cg = cell_group_config;
|
||||
mac->servCellIndex = *cell_group_config->spCellConfig->servCellIndex;
|
||||
config_control_ue(mac);
|
||||
config_common_ue(mac,module_id,cc_idP);
|
||||
mac->servCellIndex = cell_group_config->spCellConfig->servCellIndex ? *cell_group_config->spCellConfig->servCellIndex : 0;
|
||||
// config_control_ue(mac);
|
||||
// config_common_ue(mac,module_id,cc_idP);
|
||||
/*
|
||||
if(mac_cell_group_configP != NULL){
|
||||
if(mac_cell_group_configP->drx_Config != NULL ){
|
||||
|
||||
@@ -53,7 +53,8 @@ int8_t nr_ue_decode_mib(
|
||||
uint8_t extra_bits,
|
||||
uint32_t ssb_length,
|
||||
uint32_t ssb_index,
|
||||
void *pduP,
|
||||
void *pduP,
|
||||
uint16_t ssb_start_subcarrier,
|
||||
uint16_t cell_id );
|
||||
|
||||
/**\brief decode SIB1 and other SIs pdus in NR_UE, from if_module dl_ind
|
||||
|
||||
@@ -141,13 +141,21 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
|
||||
switch(rnti_type) {
|
||||
case NR_RNTI_C:
|
||||
// we use DL BWP dedicated
|
||||
sps = bwp_Common->genericParameters.cyclicPrefix == NULL ? 14 : 12;
|
||||
sps = bwp_Common ?
|
||||
(bwp_Common->genericParameters.cyclicPrefix ? 12 : 14) :
|
||||
initialDownlinkBWP->genericParameters.cyclicPrefix ? 12 : 14;
|
||||
// for SPS=14 8 MSBs in positions 13 down to 6
|
||||
monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps));
|
||||
rel15->rnti = mac->crnti;
|
||||
rel15->BWPSize = NRRIV2BW(bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
rel15->BWPStart = NRRIV2PRBOFFSET(bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
rel15->SubcarrierSpacing = bwp_Common->genericParameters.subcarrierSpacing;
|
||||
if (!bwp_Common) {
|
||||
rel15->BWPSize = NRRIV2BW(initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
rel15->BWPStart = NRRIV2PRBOFFSET(initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
}
|
||||
else {
|
||||
rel15->BWPSize = NRRIV2BW(bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
rel15->BWPStart = NRRIV2PRBOFFSET(bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
rel15->SubcarrierSpacing = bwp_Common->genericParameters.subcarrierSpacing;
|
||||
}
|
||||
for (int i = 0; i < rel15->num_dci_options; i++) {
|
||||
rel15->dci_length_options[i] = nr_dci_size(initialUplinkBWP, mac->cg, def_dci_pdu_rel15+i, rel15->dci_format_options[i], NR_RNTI_C, rel15->BWPSize, bwp_id);
|
||||
}
|
||||
@@ -247,135 +255,76 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
|
||||
|
||||
if (mac->cg) { // do this only after we have a Master or Secondary Cell group
|
||||
// loop over all available SS for BWP ID 1, CORESET ID 1
|
||||
for (ss_id = 0; ss_id < FAPI_NR_MAX_SS_PER_CORESET && mac->SSpace[bwp_id - 1][coreset_id - 1][ss_id] != NULL; ss_id++){
|
||||
LOG_D(MAC, "[DCI_CONFIG] ss_id %d\n",ss_id);
|
||||
NR_SearchSpace_t *ss = mac->SSpace[bwp_id - 1][coreset_id - 1][ss_id];
|
||||
fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15 = &dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15;
|
||||
NR_BWP_DownlinkCommon_t *bwp_Common = bwp->bwp_Common;
|
||||
NR_SetupRelease_PDCCH_ConfigCommon_t *pdcch_ConfigCommon = bwp_Common->pdcch_ConfigCommon;
|
||||
struct NR_PhysicalCellGroupConfig *phy_cgc = mac->cg->physicalCellGroupConfig;
|
||||
switch (ss->searchSpaceType->present){
|
||||
case NR_SearchSpace__searchSpaceType_PR_common:
|
||||
// this is for CSSs, we use BWP common and pdcch_ConfigCommon
|
||||
|
||||
// Fetch configuration for searchSpaceZero
|
||||
// note: The search space with the SearchSpaceId = 0 identifies the search space configured via PBCH (MIB) and in ServingCellConfigCommon (searchSpaceZero).
|
||||
if (pdcch_ConfigCommon->choice.setup->searchSpaceZero){
|
||||
if (pdcch_ConfigCommon->choice.setup->searchSpaceSIB1 == NULL){
|
||||
pdcch_ConfigCommon->choice.setup->searchSpaceSIB1=calloc(1,sizeof(*pdcch_ConfigCommon->choice.setup->searchSpaceSIB1));
|
||||
if (bwp) {
|
||||
for (ss_id = 0; ss_id < FAPI_NR_MAX_SS_PER_CORESET && mac->SSpace[bwp_id - 1][coreset_id - 1][ss_id] != NULL; ss_id++){
|
||||
LOG_D(MAC, "[DCI_CONFIG] ss_id %d\n",ss_id);
|
||||
NR_SearchSpace_t *ss = mac->SSpace[bwp_id - 1][coreset_id - 1][ss_id];
|
||||
fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15 = &dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15;
|
||||
NR_BWP_DownlinkCommon_t *bwp_Common = bwp->bwp_Common;
|
||||
NR_SetupRelease_PDCCH_ConfigCommon_t *pdcch_ConfigCommon = bwp_Common->pdcch_ConfigCommon;
|
||||
struct NR_PhysicalCellGroupConfig *phy_cgc = mac->cg->physicalCellGroupConfig;
|
||||
switch (ss->searchSpaceType->present){
|
||||
case NR_SearchSpace__searchSpaceType_PR_common:
|
||||
// this is for CSSs, we use BWP common and pdcch_ConfigCommon
|
||||
|
||||
// Fetch configuration for searchSpaceZero
|
||||
// note: The search space with the SearchSpaceId = 0 identifies the search space configured via PBCH (MIB) and in ServingCellConfigCommon (searchSpaceZero).
|
||||
if (pdcch_ConfigCommon->choice.setup->searchSpaceZero){
|
||||
if (pdcch_ConfigCommon->choice.setup->searchSpaceSIB1 == NULL){
|
||||
pdcch_ConfigCommon->choice.setup->searchSpaceSIB1=calloc(1,sizeof(*pdcch_ConfigCommon->choice.setup->searchSpaceSIB1));
|
||||
}
|
||||
*pdcch_ConfigCommon->choice.setup->searchSpaceSIB1 = 0;
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure SearchSpace#0 of the initial BWP\n");
|
||||
}
|
||||
*pdcch_ConfigCommon->choice.setup->searchSpaceSIB1 = 0;
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure SearchSpace#0 of the initial BWP\n");
|
||||
}
|
||||
if (ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0){
|
||||
// check available SS IDs
|
||||
if (pdcch_ConfigCommon->choice.setup->ra_SearchSpace){
|
||||
if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->ra_SearchSpace){
|
||||
switch(ra->ra_state){
|
||||
case WAIT_RAR:
|
||||
LOG_D(NR_MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type1-PDCCH common random access search space (RA-Msg2)\n");
|
||||
rel15->num_dci_options = 1;
|
||||
rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0;
|
||||
if (get_softmodem_params()->sa) {
|
||||
config_dci_pdu(mac, rel15, dl_config, NR_RNTI_RA, -1);
|
||||
} else {
|
||||
config_dci_pdu(mac, rel15, dl_config, NR_RNTI_RA, ss_id);
|
||||
}
|
||||
fill_dci_search_candidates(ss, rel15);
|
||||
break;
|
||||
case WAIT_CONTENTION_RESOLUTION:
|
||||
LOG_D(NR_MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type1-PDCCH common random access search space (RA-Msg4)\n");
|
||||
rel15->num_dci_options = 1;
|
||||
rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0;
|
||||
config_dci_pdu(mac, rel15, dl_config, NR_RNTI_TC, -1);
|
||||
fill_dci_search_candidates(ss, rel15);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
if (ss->searchSpaceType->choice.common->dci_Format0_0_AndFormat1_0){
|
||||
// check available SS IDs
|
||||
if (pdcch_ConfigCommon->choice.setup->ra_SearchSpace){
|
||||
if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->ra_SearchSpace){
|
||||
switch(ra->ra_state){
|
||||
case WAIT_RAR:
|
||||
LOG_D(NR_MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type1-PDCCH common random access search space (RA-Msg2)\n");
|
||||
rel15->num_dci_options = 1;
|
||||
rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0;
|
||||
if (get_softmodem_params()->sa) {
|
||||
config_dci_pdu(mac, rel15, dl_config, NR_RNTI_RA, -1);
|
||||
} else {
|
||||
config_dci_pdu(mac, rel15, dl_config, NR_RNTI_RA, ss_id);
|
||||
}
|
||||
fill_dci_search_candidates(ss, rel15);
|
||||
break;
|
||||
case WAIT_CONTENTION_RESOLUTION:
|
||||
LOG_D(NR_MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type1-PDCCH common random access search space (RA-Msg4)\n");
|
||||
rel15->num_dci_options = 1;
|
||||
rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0;
|
||||
config_dci_pdu(mac, rel15, dl_config, NR_RNTI_TC, -1);
|
||||
fill_dci_search_candidates(ss, rel15);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){
|
||||
if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){
|
||||
// Configure monitoring of PDCCH candidates in Type0-PDCCH common search space on the MCG
|
||||
LOG_W(MAC, "[DCI_CONFIG] This seach space should not be configured yet...");
|
||||
}
|
||||
}
|
||||
if (pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation){
|
||||
if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation){
|
||||
// Configure monitoring of PDCCH candidates in Type0-PDCCH common search space on the MCG
|
||||
LOG_W(MAC, "[DCI_CONFIG] This seach space should not be configured yet...");
|
||||
}
|
||||
}
|
||||
if (pdcch_ConfigCommon->choice.setup->pagingSearchSpace){
|
||||
if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->pagingSearchSpace){
|
||||
// Configure monitoring of PDCCH candidates in Type2-PDCCH common search space on the MCG
|
||||
LOG_W(MAC, "[DCI_CONFIG] This seach space should not be configured yet...");
|
||||
}
|
||||
}
|
||||
if (phy_cgc){
|
||||
if (phy_cgc->cs_RNTI){
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for dci_Format0_0_AndFormat1_0 with CRC scrambled by CS-RNTI...\n");
|
||||
LOG_W(MAC, "[DCI_CONFIG] This RNTI should not be configured yet...");
|
||||
}
|
||||
if (phy_cgc->ext1){
|
||||
if (phy_cgc->ext1->mcs_C_RNTI){
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in user specific search space for dci_Format0_0_AndFormat1_0 with CRC scrambled by MCS-C-RNTI...\n");
|
||||
LOG_W(MAC, "[DCI_CONFIG] This RNTI should not be configured yet...");
|
||||
if (pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){
|
||||
if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){
|
||||
// Configure monitoring of PDCCH candidates in Type0-PDCCH common search space on the MCG
|
||||
LOG_W(MAC, "[DCI_CONFIG] This seach space should not be configured yet...");
|
||||
}
|
||||
}
|
||||
}
|
||||
} // end DCI 00 and 01
|
||||
// DCI 2_0
|
||||
if (ss->searchSpaceType->choice.common->dci_Format2_0){
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for DCI format 2_0 with CRC scrambled by SFI-RNTI \n");
|
||||
LOG_W(MAC, "[DCI_CONFIG] This format should not be configured yet...");
|
||||
}
|
||||
// DCI 2_1
|
||||
if (ss->searchSpaceType->choice.common->dci_Format2_1){
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for DCI format 2_1 with CRC scrambled by INT-RNTI \n");
|
||||
LOG_W(MAC, "[DCI_CONFIG] This format should not be configured yet...");
|
||||
}
|
||||
// DCI 2_2
|
||||
if (ss->searchSpaceType->choice.common->dci_Format2_2){
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for DCI format 2_2 with CRC scrambled by TPC-RNTI \n");
|
||||
LOG_W(MAC, "[DCI_CONFIG] This format should not be configured yet...");
|
||||
}
|
||||
// DCI 2_3
|
||||
if (ss->searchSpaceType->choice.common->dci_Format2_3){
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for DCI format 2_3 with CRC scrambled by TPC-SRS-RNTI \n");
|
||||
LOG_W(MAC, "[DCI_CONFIG] This format should not be configured yet...");
|
||||
}
|
||||
|
||||
break;
|
||||
case NR_SearchSpace__searchSpaceType_PR_ue_Specific:
|
||||
// this is an USS
|
||||
if (ss->searchSpaceType->choice.ue_Specific){
|
||||
if(ss->searchSpaceType->choice.ue_Specific->dci_Formats == NR_SearchSpace__searchSpaceType__ue_Specific__dci_Formats_formats0_1_And_1_1){
|
||||
// Monitors DCI 01 and 11 scrambled with C-RNTI, or CS-RNTI(s), or SP-CSI-RNTI
|
||||
if ((ra->ra_state == RA_SUCCEEDED || get_softmodem_params()->phy_test) && mac->crnti > 0) {
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in the user specific search space\n");
|
||||
rel15->num_dci_options = 2;
|
||||
rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_1;
|
||||
rel15->dci_format_options[1] = NR_UL_DCI_FORMAT_0_1;
|
||||
config_dci_pdu(mac, rel15, dl_config, NR_RNTI_C, ss_id);
|
||||
fill_dci_search_candidates(ss, rel15);
|
||||
|
||||
#ifdef DEBUG_DCI
|
||||
LOG_D(MAC, "[DCI_CONFIG] ss %d ue_Specific %p searchSpaceType->present %d dci_Formats %d\n",
|
||||
ss_id,
|
||||
ss->searchSpaceType->choice.ue_Specific,
|
||||
ss->searchSpaceType->present,
|
||||
ss->searchSpaceType->choice.ue_Specific->dci_Formats);
|
||||
#endif
|
||||
if (pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation){
|
||||
if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->searchSpaceOtherSystemInformation){
|
||||
// Configure monitoring of PDCCH candidates in Type0-PDCCH common search space on the MCG
|
||||
LOG_W(MAC, "[DCI_CONFIG] This seach space should not be configured yet...");
|
||||
}
|
||||
}
|
||||
if (pdcch_ConfigCommon->choice.setup->pagingSearchSpace){
|
||||
if (ss->searchSpaceId == *pdcch_ConfigCommon->choice.setup->pagingSearchSpace){
|
||||
// Configure monitoring of PDCCH candidates in Type2-PDCCH common search space on the MCG
|
||||
LOG_W(MAC, "[DCI_CONFIG] This seach space should not be configured yet...");
|
||||
}
|
||||
}
|
||||
if (phy_cgc){
|
||||
if (phy_cgc->cs_RNTI){
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in user specific search space for dci_Format0_0_AndFormat1_0 with CRC scrambled by CS-RNTI...\n");
|
||||
LOG_W(MAC, "[DCI_CONFIG] This RNTI should not be configured yet...");
|
||||
}
|
||||
if (phy_cgc->sp_CSI_RNTI){
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in user specific search space for dci_Format0_0_AndFormat1_0 with CRC scrambled by SP-CSI-RNTI...\n");
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for dci_Format0_0_AndFormat1_0 with CRC scrambled by CS-RNTI...\n");
|
||||
LOG_W(MAC, "[DCI_CONFIG] This RNTI should not be configured yet...");
|
||||
}
|
||||
if (phy_cgc->ext1){
|
||||
@@ -385,21 +334,87 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
|
||||
}
|
||||
}
|
||||
}
|
||||
} // end DCI 00 and 01
|
||||
// DCI 2_0
|
||||
if (ss->searchSpaceType->choice.common->dci_Format2_0){
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for DCI format 2_0 with CRC scrambled by SFI-RNTI \n");
|
||||
LOG_W(MAC, "[DCI_CONFIG] This format should not be configured yet...");
|
||||
}
|
||||
// DCI 2_1
|
||||
if (ss->searchSpaceType->choice.common->dci_Format2_1){
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for DCI format 2_1 with CRC scrambled by INT-RNTI \n");
|
||||
LOG_W(MAC, "[DCI_CONFIG] This format should not be configured yet...");
|
||||
}
|
||||
// DCI 2_2
|
||||
if (ss->searchSpaceType->choice.common->dci_Format2_2){
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for DCI format 2_2 with CRC scrambled by TPC-RNTI \n");
|
||||
LOG_W(MAC, "[DCI_CONFIG] This format should not be configured yet...");
|
||||
}
|
||||
// DCI 2_3
|
||||
if (ss->searchSpaceType->choice.common->dci_Format2_3){
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in Type3-PDCCH common search space for DCI format 2_3 with CRC scrambled by TPC-SRS-RNTI \n");
|
||||
LOG_W(MAC, "[DCI_CONFIG] This format should not be configured yet...");
|
||||
}
|
||||
|
||||
break;
|
||||
case NR_SearchSpace__searchSpaceType_PR_ue_Specific:
|
||||
// this is an USS
|
||||
if (ss->searchSpaceType->choice.ue_Specific){
|
||||
if(ss->searchSpaceType->choice.ue_Specific->dci_Formats == NR_SearchSpace__searchSpaceType__ue_Specific__dci_Formats_formats0_1_And_1_1){
|
||||
// Monitors DCI 01 and 11 scrambled with C-RNTI, or CS-RNTI(s), or SP-CSI-RNTI
|
||||
if ((ra->ra_state == RA_SUCCEEDED || get_softmodem_params()->phy_test) && mac->crnti > 0) {
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in the user specific search space\n");
|
||||
rel15->num_dci_options = 2;
|
||||
rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_1;
|
||||
rel15->dci_format_options[1] = NR_UL_DCI_FORMAT_0_1;
|
||||
config_dci_pdu(mac, rel15, dl_config, NR_RNTI_C, ss_id);
|
||||
fill_dci_search_candidates(ss, rel15);
|
||||
|
||||
#ifdef DEBUG_DCI
|
||||
LOG_D(MAC, "[DCI_CONFIG] ss %d ue_Specific %p searchSpaceType->present %d dci_Formats %d\n",
|
||||
ss_id,
|
||||
ss->searchSpaceType->choice.ue_Specific,
|
||||
ss->searchSpaceType->present,
|
||||
ss->searchSpaceType->choice.ue_Specific->dci_Formats);
|
||||
#endif
|
||||
}
|
||||
if (phy_cgc){
|
||||
if (phy_cgc->cs_RNTI){
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in user specific search space for dci_Format0_0_AndFormat1_0 with CRC scrambled by CS-RNTI...\n");
|
||||
LOG_W(MAC, "[DCI_CONFIG] This RNTI should not be configured yet...");
|
||||
}
|
||||
if (phy_cgc->sp_CSI_RNTI){
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in user specific search space for dci_Format0_0_AndFormat1_0 with CRC scrambled by SP-CSI-RNTI...\n");
|
||||
LOG_W(MAC, "[DCI_CONFIG] This RNTI should not be configured yet...");
|
||||
}
|
||||
if (phy_cgc->ext1){
|
||||
if (phy_cgc->ext1->mcs_C_RNTI){
|
||||
LOG_D(MAC, "[DCI_CONFIG] Configure monitoring of PDCCH candidates in user specific search space for dci_Format0_0_AndFormat1_0 with CRC scrambled by MCS-C-RNTI...\n");
|
||||
LOG_W(MAC, "[DCI_CONFIG] This RNTI should not be configured yet...");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1 == 0, "[DCI_CONFIG] Unrecognized search space type...");
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1 == 0, "[DCI_CONFIG] Unrecognized search space type...");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
AssertFatal(1==0,"Handle DCI searching when CellGroup without dedicated BWP\n");
|
||||
}
|
||||
// Search space 0, CORESET ID 0
|
||||
|
||||
NR_BWP_DownlinkCommon_t *bwp_Common = bwp->bwp_Common;
|
||||
NR_SetupRelease_PDCCH_ConfigCommon_t *pdcch_ConfigCommon = bwp_Common->pdcch_ConfigCommon;
|
||||
NR_BWP_DownlinkCommon_t *bwp_Common = bwp ? bwp->bwp_Common : NULL;
|
||||
NR_SetupRelease_PDCCH_ConfigCommon_t *pdcch_ConfigCommon = bwp?bwp_Common->pdcch_ConfigCommon:NULL;
|
||||
|
||||
if (pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){
|
||||
if (pdcch_ConfigCommon &&
|
||||
pdcch_ConfigCommon->choice.setup->searchSpaceSIB1){
|
||||
|
||||
NR_SearchSpace_t *ss0 = mac->search_space_zero;
|
||||
fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15 = &dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15;
|
||||
@@ -413,5 +428,13 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else { // use coreset0/ss0
|
||||
NR_SearchSpace_t *ss0 = mac->search_space_zero;
|
||||
fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15 = &dl_config->dl_config_list[0].dci_config_pdu.dci_config_rel15;
|
||||
rel15->num_dci_options = 1;
|
||||
rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0;
|
||||
config_dci_pdu(mac, rel15, dl_config, NR_RNTI_C , -1);
|
||||
fill_dci_search_candidates(ss0, rel15);
|
||||
dl_config->number_pdus = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,6 +101,7 @@ int8_t nr_ue_decode_mib(module_id_t module_id,
|
||||
uint32_t ssb_length,
|
||||
uint32_t ssb_index,
|
||||
void *pduP,
|
||||
uint16_t ssb_start_subcarrier,
|
||||
uint16_t cell_id)
|
||||
{
|
||||
LOG_D(MAC,"[L2][MAC] decode mib\n");
|
||||
@@ -152,13 +153,8 @@ int8_t nr_ue_decode_mib(module_id_t module_id,
|
||||
// TODO these values shouldn't be taken from SCC in SA
|
||||
uint8_t scs_ssb = get_softmodem_params()->numerology;
|
||||
uint32_t band = get_softmodem_params()->band;
|
||||
int scs_scaling = 1<<scs_ssb;
|
||||
if (downlink_frequency[0][0] < 3e9)
|
||||
scs_scaling = scs_scaling*3;
|
||||
else
|
||||
scs_scaling = scs_scaling>>2;
|
||||
|
||||
uint16_t ssb_start_symbol = get_ssb_start_symbol(band,scs_ssb,ssb_index);
|
||||
uint16_t ssb_offset_point_a = (ssb_start_subcarrier - ssb_subcarrier_offset)/12;
|
||||
|
||||
get_type0_PDCCH_CSS_config_parameters(&mac->type0_PDCCH_CSS_config,
|
||||
frame,
|
||||
@@ -169,7 +165,7 @@ int8_t nr_ue_decode_mib(module_id_t module_id,
|
||||
scs_ssb,
|
||||
frequency_range,
|
||||
ssb_index,
|
||||
(N_RB_DL-20)>>1);
|
||||
ssb_offset_point_a);
|
||||
|
||||
|
||||
mac->type0_pdcch_ss_mux_pattern = mac->type0_PDCCH_CSS_config.type0_pdcch_ss_mux_pattern;
|
||||
@@ -375,12 +371,21 @@ int8_t nr_ue_process_dci_time_dom_resource_assignment(NR_UE_MAC_INST_t *mac,
|
||||
*/
|
||||
if(pusch_config_pdu != NULL){
|
||||
NR_PUSCH_TimeDomainResourceAllocationList_t *pusch_TimeDomainAllocationList = NULL;
|
||||
if (mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup->pusch_TimeDomainAllocationList) {
|
||||
if (mac->ULbwp[0] &&
|
||||
mac->ULbwp[0]->bwp_Dedicated &&
|
||||
mac->ULbwp[0]->bwp_Dedicated->pusch_Config &&
|
||||
mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup &&
|
||||
mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup->pusch_TimeDomainAllocationList) {
|
||||
pusch_TimeDomainAllocationList = mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup->pusch_TimeDomainAllocationList->choice.setup;
|
||||
}
|
||||
else if (mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList) {
|
||||
else if (mac->ULbwp[0] &&
|
||||
mac->ULbwp[0]->bwp_Common &&
|
||||
mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon &&
|
||||
mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup &&
|
||||
mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList) {
|
||||
pusch_TimeDomainAllocationList = mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList;
|
||||
}
|
||||
else pusch_TimeDomainAllocationList = mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList;
|
||||
|
||||
if (pusch_TimeDomainAllocationList && use_default==false) {
|
||||
if (time_domain_ind >= pusch_TimeDomainAllocationList->list.count) {
|
||||
@@ -417,9 +422,9 @@ int nr_ue_process_dci_indication_pdu(module_id_t module_id,int cc_id, int gNB_in
|
||||
|
||||
LOG_D(MAC,"Received dci indication (rnti %x,dci format %d,n_CCE %d,payloadSize %d,payload %llx)\n",
|
||||
dci->rnti,dci->dci_format,dci->n_CCE,dci->payloadSize,*(unsigned long long*)dci->payloadBits);
|
||||
|
||||
if (nr_extract_dci_info(mac, dci->dci_format, dci->payloadSize, dci->rnti, (uint64_t *)dci->payloadBits, def_dci_pdu_rel15))
|
||||
return -1;
|
||||
int8_t ret = nr_extract_dci_info(mac, dci->dci_format, dci->payloadSize, dci->rnti, (uint64_t *)dci->payloadBits, def_dci_pdu_rel15);
|
||||
if ((ret&1) == 1) return -1;
|
||||
else if (ret == 2) dci->dci_format = NR_UL_DCI_FORMAT_0_0;
|
||||
return (nr_ue_process_dci(module_id, cc_id, gNB_index, frame, slot, def_dci_pdu_rel15, dci->rnti, dci->dci_format));
|
||||
}
|
||||
|
||||
@@ -435,9 +440,10 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
|
||||
fapi_nr_dl_config_request_t *dl_config = &mac->dl_config_request;
|
||||
uint8_t is_Msg3 = 0;
|
||||
|
||||
uint16_t n_RB_DLBWP = (mac->cg) ?
|
||||
NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE) :
|
||||
mac->type0_PDCCH_CSS_config.num_rbs;
|
||||
uint16_t n_RB_DLBWP;
|
||||
if (mac->DLbwp[0]) n_RB_DLBWP = NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
else if (mac->scc_SIB) n_RB_DLBWP = NRRIV2BW(mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.locationAndBandwidth,MAX_BWP_SIZE);
|
||||
else n_RB_DLBWP = mac->type0_PDCCH_CSS_config.num_rbs;
|
||||
|
||||
LOG_D(MAC, "In %s: Processing received DCI format %s (DL BWP %d)\n", __FUNCTION__, dci_formats[dci_format], n_RB_DLBWP);
|
||||
|
||||
@@ -464,6 +470,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
|
||||
// - SUL_IND_0_0
|
||||
|
||||
// Schedule PUSCH
|
||||
|
||||
ret = nr_ue_pusch_scheduler(mac, is_Msg3, frame, slot, &frame_tx, &slot_tx, dci->time_domain_assignment.val);
|
||||
|
||||
if (ret != -1){
|
||||
@@ -1124,14 +1131,14 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
|
||||
|
||||
int pos=0;
|
||||
int fsize=0;
|
||||
|
||||
LOG_D(MAC,"nr_extract_dci_info : dci_pdu %lx, size %d\n",*dci_pdu,dci_size);
|
||||
switch(dci_format) {
|
||||
|
||||
case NR_DL_DCI_FORMAT_1_0:
|
||||
switch(rnti_type) {
|
||||
case NR_RNTI_RA:
|
||||
// check BWP id
|
||||
if (mac->cg) N_RB=NRRIV2BW(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
if (mac->DLbwp[0]) N_RB=NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
else N_RB=NRRIV2BW(mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
|
||||
// Freq domain assignment
|
||||
@@ -1174,13 +1181,14 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
|
||||
pos++;
|
||||
dci_pdu_rel15->format_indicator = (*dci_pdu>>(dci_size-pos))&1;
|
||||
if (dci_pdu_rel15->format_indicator == 0)
|
||||
return 1; // discard dci, format indicator not corresponding to dci_format
|
||||
//switch to DCI_0_0
|
||||
return 2+nr_extract_dci_info(mac, NR_UL_DCI_FORMAT_0_0, dci_size, rnti, dci_pdu, dci_pdu_rel15);
|
||||
#ifdef DEBUG_EXTRACT_DCI
|
||||
LOG_D(MAC,"Format indicator %d (%d bits) N_RB_BWP %d => %d (0x%lx)\n",dci_pdu_rel15->format_indicator,1,N_RB,dci_size-pos,*dci_pdu);
|
||||
#endif
|
||||
|
||||
// check BWP id
|
||||
if (mac->cg) N_RB=NRRIV2BW(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
if (mac->DLbwp[0]) N_RB=NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
else N_RB=NRRIV2BW(mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
|
||||
// Freq domain assignment (275rb >> fsize = 16)
|
||||
@@ -1363,7 +1371,7 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
|
||||
case NR_RNTI_TC:
|
||||
|
||||
// check BWP id
|
||||
if (mac->cg) N_RB=NRRIV2BW(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
if (mac->DLbwp[0]) N_RB=NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
else N_RB=NRRIV2BW(mac->scc_SIB->downlinkConfigCommon.initialDownlinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
|
||||
// indicating a DL DCI format - 1 bit
|
||||
@@ -1438,38 +1446,68 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
|
||||
break;
|
||||
|
||||
case NR_UL_DCI_FORMAT_0_0:
|
||||
if (mac->ULbwp[0]) N_RB_UL=NRRIV2BW(mac->ULbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
else N_RB_UL=NRRIV2BW(mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
|
||||
switch(rnti_type)
|
||||
{
|
||||
case NR_RNTI_C:
|
||||
//Identifier for DCI formats
|
||||
pos++;
|
||||
dci_pdu_rel15->format_indicator = (*dci_pdu>>(dci_size-pos))&1;
|
||||
#ifdef DEBUG_EXTRACT_DCI
|
||||
LOG_D(MAC,"Format indicator %d (%d bits)=> %d (0x%lx)\n",dci_pdu_rel15->format_indicator,1,dci_size-pos,*dci_pdu);
|
||||
#endif
|
||||
if (dci_pdu_rel15->format_indicator == 1)
|
||||
return 1; // discard dci, format indicator not corresponding to dci_format
|
||||
fsize = (int)ceil( log2( (N_RB_UL*(N_RB_UL+1))>>1 ) );
|
||||
pos+=fsize;
|
||||
dci_pdu_rel15->frequency_domain_assignment.val = (*dci_pdu>>(dci_size-pos))&((1<<fsize)-1);
|
||||
#ifdef DEBUG_EXTRACT_DCI
|
||||
LOG_D(MAC,"Freq domain assignment %d (%d bits)=> %d (0x%lx)\n",dci_pdu_rel15->frequency_domain_assignment.val,fsize,dci_size-pos,*dci_pdu);
|
||||
#endif
|
||||
// Time domain assignment 4bit
|
||||
pos+=4;
|
||||
dci_pdu_rel15->time_domain_assignment.val = (*dci_pdu>>(dci_size-pos))&0xf;
|
||||
#ifdef DEBUG_EXTRACT_DCI
|
||||
LOG_D(MAC,"time-domain assignment %d (4 bits)=> %d (0x%lx)\n",dci_pdu_rel15->time_domain_assignment.val,dci_size-pos,*dci_pdu);
|
||||
#endif
|
||||
// Frequency hopping flag E1 bit
|
||||
pos++;
|
||||
dci_pdu_rel15->frequency_hopping_flag.val= (*dci_pdu>>(dci_size-pos))&1;
|
||||
#ifdef DEBUG_EXTRACT_DCI
|
||||
LOG_D(MAC,"frequency_hopping %d (1 bit)=> %d (0x%lx)\n",dci_pdu_rel15->frequency_hopping_flag.val,dci_size-pos,*dci_pdu);
|
||||
#endif
|
||||
// MCS 5 bit
|
||||
pos+=5;
|
||||
dci_pdu_rel15->mcs= (*dci_pdu>>(dci_size-pos))&0x1f;
|
||||
#ifdef DEBUG_EXTRACT_DCI
|
||||
LOG_D(MAC,"mcs %d (5 bits)=> %d (0x%lx)\n",dci_pdu_rel15->mcs,dci_size-pos,*dci_pdu);
|
||||
#endif
|
||||
// New data indicator 1bit
|
||||
pos++;
|
||||
dci_pdu_rel15->ndi= (*dci_pdu>>(dci_size-pos))&1;
|
||||
#ifdef DEBUG_EXTRACT_DCI
|
||||
LOG_D(MAC,"NDI %d (%d bits)=> %d (0x%lx)\n",dci_pdu_rel15->ndi,1,dci_size-pos,*dci_pdu);
|
||||
#endif
|
||||
// Redundancy version 2bit
|
||||
pos+=2;
|
||||
dci_pdu_rel15->rv= (*dci_pdu>>(dci_size-pos))&3;
|
||||
#ifdef DEBUG_EXTRACT_DCI
|
||||
LOG_D(MAC,"RV %d (%d bits)=> %d (0x%lx)\n",dci_pdu_rel15->rv,2,dci_size-pos,*dci_pdu);
|
||||
#endif
|
||||
// HARQ process number 4bit
|
||||
pos+=4;
|
||||
dci_pdu_rel15->harq_pid = (*dci_pdu>>(dci_size-pos))&0xf;
|
||||
#ifdef DEBUG_EXTRACT_DCI
|
||||
LOG_D(MAC,"HARQ_PID %d (%d bits)=> %d (0x%lx)\n",dci_pdu_rel15->harq_pid,4,dci_size-pos,*dci_pdu);
|
||||
#endif
|
||||
// TPC command for scheduled PUSCH E2 bits
|
||||
pos+=2;
|
||||
dci_pdu_rel15->tpc = (*dci_pdu>>(dci_size-pos))&3;
|
||||
#ifdef DEBUG_EXTRACT_DCI
|
||||
LOG_D(MAC,"TPC %d (%d bits)=> %d (0x%lx)\n",dci_pdu_rel15->tpc,2,dci_size-pos,*dci_pdu);
|
||||
#endif
|
||||
// UL/SUL indicator E1 bit
|
||||
/* commented for now (RK): need to get this from BWP descriptor
|
||||
if (cfg->pucch_config.pucch_GroupHopping.value)
|
||||
@@ -1800,21 +1838,15 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info,
|
||||
| ((uint16_t)((NR_MAC_SUBHEADER_LONG *) pduP)->L2 & 0xff);
|
||||
mac_subheader_len = 3;
|
||||
} else {
|
||||
mac_sdu_len = ((NR_MAC_SUBHEADER_LONG *) pduP)->L1;
|
||||
mac_sdu_len = ((NR_MAC_SUBHEADER_SHORT *) pduP)->L;
|
||||
mac_subheader_len = 2;
|
||||
}
|
||||
|
||||
// Check if it is a valid CCCH message, we get all 00's messages very often
|
||||
if ( pdu_len != (mac_subheader_len+mac_sdu_len) ) {
|
||||
LOG_D(NR_MAC, "%s() Invalid CCCH message!, pdu_len: %d\n", __func__, pdu_len);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( mac_sdu_len > 0 ) {
|
||||
if ( pdu_len >= (mac_subheader_len + mac_sdu_len) ) {
|
||||
|
||||
LOG_D(NR_MAC,"DL_SCH_LCID_CCCH with payload len %d\n", mac_sdu_len);
|
||||
|
||||
LOG_D(NR_MAC,"RRCSetup received at nr_ue_process_mac_pdu with payload len %d \n", mac_sdu_len);
|
||||
LOG_D(NR_MAC,"RRCSetup received at nr_ue_process_mac_pdu with payload len %d: \n", mac_sdu_len);
|
||||
for (int i = 0; i < mac_subheader_len; i++) {
|
||||
LOG_D(NR_MAC, "MAC header %d: 0x%x\n", i, pduP[i]);
|
||||
}
|
||||
|
||||
@@ -93,14 +93,22 @@ void fill_scheduled_response(nr_scheduled_response_t *scheduled_response,
|
||||
long get_k2(NR_UE_MAC_INST_t *mac, uint8_t time_domain_ind) {
|
||||
long k2 = -1;
|
||||
// Get K2 from RRC configuration
|
||||
NR_PUSCH_Config_t *pusch_config=mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup;
|
||||
NR_PUSCH_Config_t *pusch_config=mac->ULbwp[0] ? mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup : NULL;
|
||||
NR_PUSCH_TimeDomainResourceAllocationList_t *pusch_TimeDomainAllocationList = NULL;
|
||||
if (pusch_config->pusch_TimeDomainAllocationList) {
|
||||
if (pusch_config && pusch_config->pusch_TimeDomainAllocationList) {
|
||||
pusch_TimeDomainAllocationList = pusch_config->pusch_TimeDomainAllocationList->choice.setup;
|
||||
}
|
||||
else if (mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList) {
|
||||
else if (mac->ULbwp[0] &&
|
||||
mac->ULbwp[0]->bwp_Common&&
|
||||
mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon&&
|
||||
mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup &&
|
||||
mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList) {
|
||||
pusch_TimeDomainAllocationList = mac->ULbwp[0]->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList;
|
||||
}
|
||||
else if (mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList)
|
||||
pusch_TimeDomainAllocationList=mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList;
|
||||
else AssertFatal(1==0,"need to fall back to default PUSCH time-domain allocations\n");
|
||||
|
||||
if (pusch_TimeDomainAllocationList) {
|
||||
if (time_domain_ind >= pusch_TimeDomainAllocationList->list.count) {
|
||||
LOG_E(MAC, "time_domain_ind %d >= pusch->TimeDomainAllocationList->list.count %d\n",
|
||||
@@ -135,11 +143,13 @@ fapi_nr_ul_config_request_t *get_ul_config_request(NR_UE_MAC_INST_t *mac, int sl
|
||||
// Calculate the index of the UL slot in mac->ul_config_request list. This is
|
||||
// based on the TDD pattern (slot configuration period) and number of UL+mixed
|
||||
// slots in the period. TS 38.213 Sec 11.1
|
||||
int mu = (mac->cg) ? mac->ULbwp[0]->bwp_Common->genericParameters.subcarrierSpacing : get_softmodem_params()->numerology;
|
||||
int mu = mac->ULbwp[0] ?
|
||||
mac->ULbwp[0]->bwp_Common->genericParameters.subcarrierSpacing :
|
||||
mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.subcarrierSpacing;
|
||||
NR_TDD_UL_DL_Pattern_t *tdd_pattern = &tdd_config->pattern1;
|
||||
const int num_slots_per_tdd = nr_slots_per_frame[mu] >> (7 - tdd_pattern->dl_UL_TransmissionPeriodicity);
|
||||
const int num_slots_ul = tdd_pattern->nrofUplinkSlots + (tdd_pattern->nrofUplinkSymbols!=0);
|
||||
int index = (slot + num_slots_ul - num_slots_per_tdd) % num_slots_per_tdd;
|
||||
int index = (slot + num_slots_ul) % num_slots_per_tdd;
|
||||
|
||||
LOG_D(MAC, "In %s slots per tdd %d, num_slots_ul %d, index %d\n", __FUNCTION__,
|
||||
num_slots_per_tdd,
|
||||
@@ -493,7 +503,12 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
||||
NR_BWP_UplinkDedicated_t *ibwp;
|
||||
int scs,abwp_start,abwp_size,startSymbolAndLength;
|
||||
NR_PUSCH_Config_t *pusch_Config=NULL;
|
||||
if (mac->cg) {
|
||||
if (mac->cg && ubwp &&
|
||||
mac->cg->spCellConfig &&
|
||||
mac->cg->spCellConfig->spCellConfigDedicated &&
|
||||
mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig &&
|
||||
mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP
|
||||
) {
|
||||
ibwp = mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP;
|
||||
pusch_Config = ibwp->pusch_Config->choice.setup;
|
||||
startSymbolAndLength = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[rar_grant->Msg3_t_alloc]->startSymbolAndLength;
|
||||
@@ -583,9 +598,21 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
||||
|
||||
int target_ss;
|
||||
bool valid_ptrs_setup = 0;
|
||||
uint16_t n_RB_ULBWP = NRRIV2BW(mac->ULbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
uint16_t n_RB_ULBWP;
|
||||
if (mac->ULbwp[0] &&
|
||||
mac->ULbwp[0]->bwp_Common) {
|
||||
n_RB_ULBWP = NRRIV2BW(mac->ULbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
pusch_config_pdu->bwp_start = NRRIV2PRBOFFSET(mac->ULbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
}
|
||||
else {
|
||||
pusch_config_pdu->bwp_start = NRRIV2PRBOFFSET(mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
n_RB_ULBWP = NRRIV2BW(mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
}
|
||||
|
||||
pusch_config_pdu->bwp_size = n_RB_ULBWP;
|
||||
|
||||
fapi_nr_pusch_config_dedicated_t *pusch_config_dedicated = &mac->phy_config.config_req.ul_bwp_dedicated.pusch_config_dedicated;
|
||||
NR_PUSCH_Config_t *pusch_Config = mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup;
|
||||
NR_PUSCH_Config_t *pusch_Config = mac->ULbwp[0] ? mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup : NULL;
|
||||
|
||||
// Basic sanity check for MCS value to check for a false or erroneous DCI
|
||||
if (dci->mcs > 28) {
|
||||
@@ -676,9 +703,9 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
||||
|
||||
/* MCS TABLE */
|
||||
if (pusch_config_pdu->transform_precoding == transform_precoder_disabled) {
|
||||
pusch_config_pdu->mcs_table = get_pusch_mcs_table(pusch_Config->mcs_Table, 0, *dci_format, rnti_type, target_ss, false);
|
||||
pusch_config_pdu->mcs_table = get_pusch_mcs_table(pusch_Config ? pusch_Config->mcs_Table : NULL, 0, *dci_format, rnti_type, target_ss, false);
|
||||
} else {
|
||||
pusch_config_pdu->mcs_table = get_pusch_mcs_table(pusch_Config->mcs_TableTransformPrecoder, 1, *dci_format, rnti_type, target_ss, false);
|
||||
pusch_config_pdu->mcs_table = get_pusch_mcs_table(pusch_Config ? pusch_Config->mcs_TableTransformPrecoder : NULL, 1, *dci_format, rnti_type, target_ss, false);
|
||||
}
|
||||
|
||||
/* NDI */
|
||||
@@ -703,19 +730,31 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
||||
}
|
||||
|
||||
/* DMRS */
|
||||
l_prime_mask = get_l_prime(pusch_config_pdu->nr_of_symbols, typeB, pusch_dmrs_pos0, pusch_len1);
|
||||
if (pusch_config_pdu->transform_precoding == transform_precoder_disabled)
|
||||
l_prime_mask = get_l_prime(pusch_config_pdu->nr_of_symbols, typeB,
|
||||
(*dci_format == NR_UL_DCI_FORMAT_0_1) ? pusch_dmrs_pos0 : pusch_dmrs_pos2, pusch_len1);
|
||||
if ((mac->ULbwp[0] && pusch_config_pdu->transform_precoding == transform_precoder_disabled))
|
||||
pusch_config_pdu->num_dmrs_cdm_grps_no_data = 1;
|
||||
|
||||
else if (*dci_format == NR_UL_DCI_FORMAT_0_0 || mac->ULbwp[0] && pusch_config_pdu->transform_precoding == transform_precoder_enabled)
|
||||
pusch_config_pdu->num_dmrs_cdm_grps_no_data = 2;
|
||||
|
||||
// Num PRB Overhead from PUSCH-ServingCellConfig
|
||||
if (mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->xOverhead == NULL) {
|
||||
N_PRB_oh = 0;
|
||||
} else {
|
||||
if (mac->cg &&
|
||||
mac->cg->spCellConfig &&
|
||||
mac->cg->spCellConfig->spCellConfigDedicated &&
|
||||
mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig &&
|
||||
mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig &&
|
||||
mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->xOverhead)
|
||||
N_PRB_oh = *mac->cg->spCellConfig->spCellConfigDedicated->uplinkConfig->pusch_ServingCellConfig->choice.setup->xOverhead;
|
||||
}
|
||||
|
||||
else N_PRB_oh = 0;
|
||||
|
||||
/* PTRS */
|
||||
if (mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS != NULL) {
|
||||
if (mac->ULbwp[0] &&
|
||||
mac->ULbwp[0]->bwp_Dedicated &&
|
||||
mac->ULbwp[0]->bwp_Dedicated->pusch_Config &&
|
||||
mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup &&
|
||||
mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB &&
|
||||
mac->ULbwp[0]->bwp_Dedicated->pusch_Config->choice.setup->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS) {
|
||||
if (pusch_config_pdu->transform_precoding == transform_precoder_disabled) {
|
||||
nfapi_nr_ue_ptrs_ports_t ptrs_ports_list;
|
||||
pusch_config_pdu->pusch_ptrs.ptrs_ports_list = &ptrs_ports_list;
|
||||
@@ -789,9 +828,8 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
|
||||
|
||||
// check type0 from 38.213 13 if we have no CellGroupConfig
|
||||
// TODO: implementation to be completed
|
||||
LOG_D(MAC,"nr_ue_scheduler(): mac->cg %p\n",mac->cg);
|
||||
if (mac->cg == NULL) {
|
||||
|
||||
|
||||
if(dl_info->ssb_index != -1){
|
||||
|
||||
if(mac->type0_pdcch_ss_mux_pattern == 1){
|
||||
@@ -858,7 +896,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
|
||||
config_dci_pdu(mac, rel15, dl_config, mac->ra.ra_state == WAIT_RAR ? NR_RNTI_RA : NR_RNTI_TC , -1);
|
||||
fill_dci_search_candidates(ss0, rel15);
|
||||
dl_config->number_pdus = 1;
|
||||
LOG_D(MAC,"Calling fill_scheduled_response rnti %x, type0_pdcch, num_pdus %d\n",dl_config->number_pdus);
|
||||
LOG_D(MAC,"mac->cg %p: Calling fill_scheduled_response rnti %x, type0_pdcch, num_pdus %d\n",mac->cg,rel15->rnti,dl_config->number_pdus);
|
||||
fill_scheduled_response(&scheduled_response, dl_config, NULL, NULL, mod_id, cc_id, rx_frame, rx_slot, dl_info->thread_id);
|
||||
if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL)
|
||||
mac->if_module->scheduled_response(&scheduled_response);
|
||||
@@ -1018,10 +1056,11 @@ int nr_ue_pusch_scheduler(NR_UE_MAC_INST_t *mac,
|
||||
int delta = 0;
|
||||
NR_BWP_Uplink_t *ubwp = mac->ULbwp[0];
|
||||
// Get the numerology to calculate the Tx frame and slot
|
||||
int mu = mac->cg ?
|
||||
int mu = ubwp ?
|
||||
ubwp->bwp_Common->genericParameters.subcarrierSpacing :
|
||||
mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.genericParameters.subcarrierSpacing;
|
||||
NR_PUSCH_TimeDomainResourceAllocationList_t *pusch_TimeDomainAllocationList = mac->cg ?
|
||||
|
||||
NR_PUSCH_TimeDomainResourceAllocationList_t *pusch_TimeDomainAllocationList = ubwp ?
|
||||
ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList:
|
||||
mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList;
|
||||
// k2 as per 3GPP TS 38.214 version 15.9.0 Release 15 ch 6.1.2.1.1
|
||||
@@ -1757,7 +1796,6 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s
|
||||
(int)frameP,
|
||||
(int)slotP,
|
||||
&prach_occasion_info_p);
|
||||
LOG_I(PHY,"Before generate preamble, is_nr_prach_slot %d, ra->ra_stats %d\n",is_nr_prach_slot,ra->ra_state);
|
||||
|
||||
if (is_nr_prach_slot && ra->ra_state == RA_UE_IDLE) {
|
||||
AssertFatal(NULL != prach_occasion_info_p,"PRACH Occasion Info not returned in a valid NR Prach Slot\n");
|
||||
|
||||
@@ -392,7 +392,7 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
|
||||
else
|
||||
ulsch_in_slot_bitmap = BIT( 8) | BIT(18);
|
||||
|
||||
memset(RC.nrmac[module_idP]->cce_list[bwp_id][0],0,MAX_NUM_CCE*sizeof(int)); // coreset0
|
||||
memset(RC.nrmac[module_idP]->cce_list[0][0],0,MAX_NUM_CCE*sizeof(int)); // coreset0
|
||||
memset(RC.nrmac[module_idP]->cce_list[bwp_id][1],0,MAX_NUM_CCE*sizeof(int)); // coresetid 1
|
||||
NR_UE_info_t *UE_info = &RC.nrmac[module_idP]->UE_info;
|
||||
for (int UE_id = UE_info->list.head; UE_id >= 0; UE_id = UE_info->list.next[UE_id])
|
||||
|
||||
@@ -1098,6 +1098,8 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
pdsch_pdu_rel15->BWPSize,
|
||||
nr_mac->sched_ctrlCommon->active_bwp->bwp_Id);
|
||||
|
||||
|
||||
|
||||
// DL TX request
|
||||
nfapi_nr_pdu_t *tx_req = &nr_mac->TX_req[CC_id].pdu_list[nr_mac->TX_req[CC_id].Number_of_PDUs];
|
||||
|
||||
@@ -1172,7 +1174,27 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
harq->is_waiting = true;
|
||||
ra->harq_pid = current_harq_pid;
|
||||
|
||||
nr_acknack_scheduling(module_idP, UE_id, frameP, slotP);
|
||||
// get CCEindex, needed also for PUCCH and then later for PDCCH
|
||||
uint8_t aggregation_level;
|
||||
uint8_t nr_of_candidates;
|
||||
find_aggregation_candidates(&aggregation_level, &nr_of_candidates, ss);
|
||||
int CCEIndex = allocate_nr_CCEs(nr_mac, bwp, coreset, aggregation_level,0,0,nr_of_candidates);
|
||||
if (CCEIndex < 0) {
|
||||
LOG_E(NR_MAC, "%s(): cannot find free CCE for RA RNTI %04x!\n", __func__, ra->rnti);
|
||||
return;
|
||||
}
|
||||
|
||||
int n_rb=0;
|
||||
for (int i=0;i<6;i++)
|
||||
for (int j=0;j<8;j++) {
|
||||
n_rb+=((coreset->frequencyDomainResources.buf[i]>>j)&1);
|
||||
}
|
||||
n_rb*=6;
|
||||
const uint16_t N_cce = n_rb * coreset->duration / NR_NB_REG_PER_CCE;
|
||||
const delta_PRI=0;
|
||||
int r_pucch = ((CCEIndex<<1)/N_cce)+(delta_PRI<<1);
|
||||
|
||||
nr_acknack_scheduling(module_idP, UE_id, frameP, slotP,r_pucch);
|
||||
harq->feedback_slot = sched_ctrl->sched_pucch->ul_slot;
|
||||
|
||||
// Bytes to be transmitted
|
||||
@@ -1186,7 +1208,10 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
((NR_MAC_SUBHEADER_SHORT *) &buf[mac_pdu_length])->L = mac_sdu_length;
|
||||
mac_pdu_length = mac_pdu_length + mac_sdu_length + sizeof(NR_MAC_SUBHEADER_SHORT);
|
||||
|
||||
LOG_D(NR_MAC,"Encoded RRCSetup Piggyback (%d + %d bytes), mac_pdu_length %d\n",mac_sdu_length,sizeof(NR_MAC_SUBHEADER_SHORT),mac_pdu_length);
|
||||
LOG_D(NR_MAC,"Encoded RRCSetup Piggyback (%d + %d bytes), mac_pdu_length %d\n",
|
||||
mac_sdu_length,
|
||||
(int)sizeof(NR_MAC_SUBHEADER_SHORT),
|
||||
mac_pdu_length);
|
||||
// Calculate number of symbols
|
||||
int startSymbolIndex, nrOfSymbols;
|
||||
const int startSymbolAndLength = bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList->list.array[time_domain_assignment]->startSymbolAndLength;
|
||||
@@ -1254,14 +1279,6 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t aggregation_level;
|
||||
uint8_t nr_of_candidates;
|
||||
find_aggregation_candidates(&aggregation_level, &nr_of_candidates, ss);
|
||||
int CCEIndex = allocate_nr_CCEs(nr_mac, bwp, coreset, aggregation_level,0,0,nr_of_candidates);
|
||||
if (CCEIndex < 0) {
|
||||
LOG_E(NR_MAC, "%s(): cannot find free CCE for RA RNTI %04x!\n", __func__, ra->rnti);
|
||||
return;
|
||||
}
|
||||
|
||||
// look up the PDCCH PDU for this CC, BWP, and CORESET. If it does not exist, create it. This is especially
|
||||
// important if we have multiple RAs, and the DLSCH has to reuse them, so we need to mark them
|
||||
@@ -1373,7 +1390,7 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
dci_payload.ndi = harq->ndi;
|
||||
dci_payload.dai[0].val = (sched_ctrl->sched_pucch->dai_c-1)&3;
|
||||
dci_payload.tpc = sched_ctrl->tpc1; // TPC for PUCCH: table 7.2.1-1 in 38.213
|
||||
dci_payload.pucch_resource_indicator = sched_ctrl->sched_pucch->resource_indicator;
|
||||
dci_payload.pucch_resource_indicator = delta_PRI; // This is delta_PRI from 9.2.1 in 38.213
|
||||
dci_payload.pdsch_to_harq_feedback_timing_indicator.val = sched_ctrl->sched_pucch->timing_indicator;
|
||||
|
||||
LOG_D(NR_MAC,
|
||||
@@ -1407,6 +1424,16 @@ void nr_generate_Msg4(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra
|
||||
pdsch_pdu_rel15->BWPSize,
|
||||
bwp_Id);
|
||||
|
||||
// Add padding header and zero rest out if there is space left
|
||||
if (mac_pdu_length < harq->tb_size) {
|
||||
NR_MAC_SUBHEADER_FIXED *padding = (NR_MAC_SUBHEADER_FIXED *) &buf[mac_pdu_length];
|
||||
padding->R = 0;
|
||||
padding->LCID = DL_SCH_LCID_PADDING;
|
||||
for(int k = mac_pdu_length+1; k<harq->tb_size; k++) {
|
||||
buf[k] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// DL TX request
|
||||
nfapi_nr_pdu_t *tx_req = &nr_mac->TX_req[CC_id].pdu_list[nr_mac->TX_req[CC_id].Number_of_PDUs];
|
||||
memcpy(tx_req->TLVs[0].value.direct, harq->tb, sizeof(uint8_t) * harq->tb_size);
|
||||
@@ -1460,6 +1487,7 @@ void nr_check_Msg4_Ack(module_id_t module_id, int CC_id, frame_t frame, sub_fram
|
||||
LOG_I(NR_MAC, "(ue %i, rnti 0x%04x) Received Ack of RA-Msg4. CBRA procedure succeeded!\n", UE_id, ra->rnti);
|
||||
nr_clear_ra_proc(module_id, CC_id, frame, ra);
|
||||
UE_info->active[UE_id] = true;
|
||||
UE_info->Msg4_ACKed[UE_id] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -302,9 +302,11 @@ int nr_write_ce_dlsch_pdu(module_id_t module_idP,
|
||||
return offset;
|
||||
}
|
||||
|
||||
void getStartNrOfSymbols(NR_BWP_Downlink_t *bwp, int tda, int *startSymbol, int *nrOfSymbols) {
|
||||
void getStartNrOfSymbols(NR_BWP_Downlink_t *bwp, NR_ServingCellConfigCommon_t *scc,int tda, int *startSymbol, int *nrOfSymbols) {
|
||||
struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList =
|
||||
bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
|
||||
bwp?
|
||||
bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList:
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
|
||||
AssertFatal(tda < tdaList->list.count,
|
||||
"time_domain_allocation %d>=%d\n",
|
||||
tda,
|
||||
@@ -315,7 +317,9 @@ void getStartNrOfSymbols(NR_BWP_Downlink_t *bwp, int tda, int *startSymbol, int
|
||||
}
|
||||
|
||||
nfapi_nr_dmrs_type_e getDmrsConfigType(NR_BWP_Downlink_t *bwp) {
|
||||
return bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1;
|
||||
return bwp?
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1:
|
||||
0;
|
||||
}
|
||||
|
||||
uint8_t getN_PRB_DMRS(NR_BWP_Downlink_t *bwp, int numDmrsCdmGrpsNoData) {
|
||||
@@ -354,7 +358,7 @@ void nr_store_dlsch_buffer(module_id_t module_id,
|
||||
0,
|
||||
0);
|
||||
sched_ctrl->num_total_bytes += sched_ctrl->rlc_status[lcid].bytes_in_buffer;
|
||||
LOG_I(MAC,
|
||||
LOG_D(MAC,
|
||||
"%d.%d, LCID%d:->DLSCH, RLC status %d bytes. \n",
|
||||
frame,
|
||||
slot,
|
||||
@@ -435,8 +439,9 @@ void pf_dl(module_id_t module_id,
|
||||
uint8_t *rballoc_mask,
|
||||
int max_num_ue) {
|
||||
|
||||
NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info;
|
||||
NR_ServingCellConfigCommon_t *scc=RC.nrmac[module_id]->common_channels[0].ServingCellConfigCommon;
|
||||
gNB_MAC_INST *mac = RC.nrmac[module_id];
|
||||
NR_UE_info_t *UE_info = &mac->UE_info;
|
||||
NR_ServingCellConfigCommon_t *scc=mac->common_channels[0].ServingCellConfigCommon;
|
||||
float coeff_ue[MAX_MOBILES_PER_GNB];
|
||||
// UEs that could be scheduled
|
||||
int ue_array[MAX_MOBILES_PER_GNB];
|
||||
@@ -444,13 +449,15 @@ void pf_dl(module_id_t module_id,
|
||||
|
||||
/* Loop UE_info->list to check retransmission */
|
||||
for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
|
||||
if (UE_info->Msg4_ACKed[UE_id] != true) continue;
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
int bwp_Id = sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Id : 0;
|
||||
sched_ctrl->search_space = get_searchspace(scc,sched_ctrl->active_bwp,
|
||||
sched_ctrl->active_bwp ?
|
||||
NR_SearchSpace__searchSpaceType_PR_ue_Specific:
|
||||
NR_SearchSpace__searchSpaceType_PR_common);
|
||||
sched_ctrl->coreset = get_coreset(scc,sched_ctrl->active_bwp, sched_ctrl->search_space, 1 /* dedicated */);
|
||||
if (sched_ctrl->coreset == NULL) sched_ctrl->coreset = RC.nrmac[module_id]->sched_ctrlCommon->coreset;
|
||||
if (sched_ctrl->coreset == NULL) sched_ctrl->coreset = mac->sched_ctrlCommon->coreset;
|
||||
/* get the PID of a HARQ process awaiting retrnasmission, or -1 otherwise */
|
||||
sched_ctrl->dl_harq_pid = sched_ctrl->retrans_dl_harq.head;
|
||||
const rnti_t rnti = UE_info->rnti[UE_id];
|
||||
@@ -470,7 +477,7 @@ void pf_dl(module_id_t module_id,
|
||||
}
|
||||
/* Find PUCCH occasion: if it fails, undo CCE allocation (undoing PUCCH
|
||||
* allocation after CCE alloc fail would be more complex) */
|
||||
const bool alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot);
|
||||
const bool alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot,-1);
|
||||
if (!alloc) {
|
||||
LOG_W(MAC,
|
||||
"%s(): could not find PUCCH for UE %d/%04x@%d.%d\n",
|
||||
@@ -481,7 +488,7 @@ void pf_dl(module_id_t module_id,
|
||||
slot);
|
||||
int cid = sched_ctrl->coreset->controlResourceSetId;
|
||||
UE_info->num_pdcch_cand[UE_id][cid]--;
|
||||
int *cce_list = RC.nrmac[module_id]->cce_list[sched_ctrl->active_bwp->bwp_Id][cid];
|
||||
int *cce_list = mac->cce_list[bwp_Id][cid];
|
||||
for (int i = 0; i < sched_ctrl->aggregation_level; i++)
|
||||
cce_list[sched_ctrl->cce_index + i] = 0;
|
||||
return;
|
||||
@@ -504,12 +511,12 @@ void pf_dl(module_id_t module_id,
|
||||
sched_ctrl->time_domain_allocation = 2;
|
||||
sched_ctrl->mcsTableIdx = 0;
|
||||
sched_ctrl->mcs = 9;
|
||||
sched_ctrl->numDmrsCdmGrpsNoData = 1;
|
||||
sched_ctrl->numDmrsCdmGrpsNoData = sched_ctrl->active_bwp ? 2 : 1;
|
||||
uint8_t N_PRB_DMRS =
|
||||
getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->numDmrsCdmGrpsNoData);
|
||||
getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->numDmrsCdmGrpsNoData);
|
||||
int startSymbol;
|
||||
int nrOfSymbols;
|
||||
getStartNrOfSymbols(sched_ctrl->active_bwp,
|
||||
getStartNrOfSymbols(sched_ctrl->active_bwp,scc,
|
||||
sched_ctrl->time_domain_allocation,
|
||||
&startSymbol,
|
||||
&nrOfSymbols);
|
||||
@@ -551,9 +558,14 @@ void pf_dl(module_id_t module_id,
|
||||
*p = -1;
|
||||
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
int bwp_Id = sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Id : 0;
|
||||
const uint16_t rnti = UE_info->rnti[UE_id];
|
||||
const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
int rbStart = NRRIV2PRBOFFSET(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
NR_BWP_t *genericParameters = sched_ctrl->active_bwp ?
|
||||
&sched_ctrl->active_bwp->bwp_Common->genericParameters:
|
||||
&scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters;
|
||||
|
||||
const uint16_t bwpSize = NRRIV2BW(genericParameters->locationAndBandwidth,MAX_BWP_SIZE);
|
||||
int rbStart = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);
|
||||
|
||||
/* Find a free CCE */
|
||||
bool freeCCE = find_free_CCE(module_id, slot, UE_id);
|
||||
@@ -567,7 +579,7 @@ void pf_dl(module_id_t module_id,
|
||||
|
||||
/* Find PUCCH occasion: if it fails, undo CCE allocation (undoing PUCCH
|
||||
* allocation after CCE alloc fail would be more complex) */
|
||||
const bool alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot);
|
||||
const bool alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot,-1);
|
||||
if (!alloc) {
|
||||
LOG_W(MAC,
|
||||
"%s(): could not find PUCCH for UE %d/%04x@%d.%d\n",
|
||||
@@ -578,7 +590,7 @@ void pf_dl(module_id_t module_id,
|
||||
slot);
|
||||
int cid = sched_ctrl->coreset->controlResourceSetId;
|
||||
UE_info->num_pdcch_cand[UE_id][cid]--;
|
||||
int *cce_list = RC.nrmac[module_id]->cce_list[sched_ctrl->active_bwp->bwp_Id][cid];
|
||||
int *cce_list = mac->cce_list[bwp_Id][cid];
|
||||
for (int i = 0; i < sched_ctrl->aggregation_level; i++)
|
||||
cce_list[sched_ctrl->cce_index + i] = 0;
|
||||
return;
|
||||
@@ -591,22 +603,22 @@ void pf_dl(module_id_t module_id,
|
||||
// modulation scheme
|
||||
sched_ctrl->mcsTableIdx = 0;
|
||||
sched_ctrl->mcs = 9;
|
||||
sched_ctrl->numDmrsCdmGrpsNoData = 1;
|
||||
sched_ctrl->numDmrsCdmGrpsNoData = sched_ctrl->active_bwp ? 1 : 2;
|
||||
|
||||
// Freq-demain allocation
|
||||
while (rbStart < bwpSize && !rballoc_mask[rbStart]) rbStart++;
|
||||
|
||||
const uint8_t N_PRB_DMRS =
|
||||
getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->numDmrsCdmGrpsNoData);
|
||||
getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->numDmrsCdmGrpsNoData);
|
||||
int startSymbol;
|
||||
int nrOfSymbols;
|
||||
getStartNrOfSymbols(sched_ctrl->active_bwp,
|
||||
getStartNrOfSymbols(sched_ctrl->active_bwp,scc,
|
||||
sched_ctrl->time_domain_allocation,
|
||||
&startSymbol,
|
||||
&nrOfSymbols);
|
||||
const NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels->ServingCellConfigCommon;
|
||||
const NR_ServingCellConfigCommon_t *scc = mac->common_channels->ServingCellConfigCommon;
|
||||
const uint8_t N_DMRS_SLOT = get_num_dmrs_symbols(
|
||||
sched_ctrl->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup,
|
||||
sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup : NULL,
|
||||
scc->dmrs_TypeA_Position,
|
||||
nrOfSymbols,
|
||||
startSymbol);
|
||||
@@ -715,7 +727,9 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
|
||||
/* POST processing */
|
||||
struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList =
|
||||
sched_ctrl->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
|
||||
sched_ctrl->active_bwp ?
|
||||
sched_ctrl->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList:
|
||||
scc->downlinkConfigCommon->initialDownlinkBWP->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
|
||||
AssertFatal(sched_ctrl->time_domain_allocation < tdaList->list.count,
|
||||
"time_domain_allocation %d>=%d\n",
|
||||
sched_ctrl->time_domain_allocation,
|
||||
@@ -728,7 +742,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
|
||||
uint8_t N_PRB_DMRS =
|
||||
getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->numDmrsCdmGrpsNoData);
|
||||
uint8_t N_DMRS_SLOT = get_num_dmrs_symbols(sched_ctrl->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup,
|
||||
uint8_t N_DMRS_SLOT = get_num_dmrs_symbols(sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup:NULL,
|
||||
RC.nrmac[module_id]->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position ,
|
||||
nrOfSymbols,
|
||||
startSymbolIndex);
|
||||
@@ -773,7 +787,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
harq->is_waiting = true;
|
||||
UE_info->mac_stats[UE_id].dlsch_rounds[harq->round]++;
|
||||
|
||||
LOG_D(MAC,
|
||||
LOG_I(MAC,
|
||||
"%4d.%2d RNTI %04x start %d RBs %d startSymbol %d nb_symbsol %d MCS %d TBS %d HARQ PID %d round %d NDI %d\n",
|
||||
frame,
|
||||
slot,
|
||||
@@ -789,15 +803,11 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
harq->ndi);
|
||||
|
||||
NR_BWP_Downlink_t *bwp = sched_ctrl->active_bwp;
|
||||
AssertFatal(bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList,
|
||||
"searchSpacesToAddModList is null\n");
|
||||
AssertFatal(bwp->bwp_Dedicated->pdcch_Config->choice.setup->searchSpacesToAddModList->list.count > 0,
|
||||
"searchSPacesToAddModList is empty\n");
|
||||
|
||||
/* look up the PDCCH PDU for this CC, BWP, and CORESET. If it does not
|
||||
* exist, create it */
|
||||
const int bwpid = sched_ctrl->active_bwp->bwp_Id;
|
||||
const int coresetid = sched_ctrl->coreset->controlResourceSetId;
|
||||
const int bwpid = bwp ? bwp->bwp_Id : 0;
|
||||
const int coresetid = bwp ? sched_ctrl->coreset->controlResourceSetId : gNB_mac->sched_ctrlCommon->coreset->controlResourceSetId;
|
||||
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu = gNB_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid];
|
||||
if (!pdcch_pdu) {
|
||||
nfapi_nr_dl_tti_request_pdu_t *dl_tti_pdcch_pdu = &dl_req->dl_tti_pdu_list[dl_req->nPDUs];
|
||||
@@ -806,7 +816,10 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
dl_tti_pdcch_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdcch_pdu));
|
||||
dl_req->nPDUs += 1;
|
||||
pdcch_pdu = &dl_tti_pdcch_pdu->pdcch_pdu.pdcch_pdu_rel15;
|
||||
nr_configure_pdcch(pdcch_pdu, sched_ctrl->search_space, sched_ctrl->coreset, scc, bwp);
|
||||
LOG_I(MAC,"Trying to configure DL pdcch for bwp %d, cs %d\n",bwpid,coresetid);
|
||||
NR_SearchSpace_t *ss = bwp ? sched_ctrl->search_space:gNB_mac->sched_ctrlCommon->search_space;
|
||||
NR_ControlResourceSet_t *coreset = bwp? sched_ctrl->coreset:gNB_mac->sched_ctrlCommon->coreset;
|
||||
nr_configure_pdcch(pdcch_pdu, ss, coreset, scc, bwp);
|
||||
gNB_mac->pdcch_pdu_idx[CC_id][bwpid][coresetid] = pdcch_pdu;
|
||||
}
|
||||
|
||||
@@ -826,13 +839,13 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
pdsch_pdu->pduIndex = pduindex;
|
||||
|
||||
// BWP
|
||||
pdsch_pdu->BWPSize = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
pdsch_pdu->BWPStart = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth,MAX_BWP_SIZE);
|
||||
pdsch_pdu->SubcarrierSpacing = bwp->bwp_Common->genericParameters.subcarrierSpacing;
|
||||
if (bwp->bwp_Common->genericParameters.cyclicPrefix)
|
||||
pdsch_pdu->CyclicPrefix = *bwp->bwp_Common->genericParameters.cyclicPrefix;
|
||||
else
|
||||
pdsch_pdu->CyclicPrefix = 0;
|
||||
NR_BWP_t *genericParameters = bwp ? &bwp->bwp_Common->genericParameters : &scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters;
|
||||
|
||||
pdsch_pdu->BWPSize = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);
|
||||
pdsch_pdu->BWPStart = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth,MAX_BWP_SIZE);
|
||||
pdsch_pdu->SubcarrierSpacing = genericParameters->subcarrierSpacing;
|
||||
|
||||
pdsch_pdu->CyclicPrefix = genericParameters->cyclicPrefix ? *genericParameters->cyclicPrefix : 0;
|
||||
|
||||
// Codeword information
|
||||
pdsch_pdu->NrOfCodewords = 1;
|
||||
@@ -850,7 +863,9 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
|
||||
// DMRS
|
||||
pdsch_pdu->dlDmrsSymbPos =
|
||||
fill_dmrs_mask(bwp->bwp_Dedicated->pdsch_Config->choice.setup,
|
||||
fill_dmrs_mask(bwp && bwp->bwp_Dedicated &&
|
||||
bwp->bwp_Dedicated->pdsch_Config &&
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup ? bwp->bwp_Dedicated->pdsch_Config->choice.setup : NULL,
|
||||
scc->dmrs_TypeA_Position,
|
||||
nrOfSymbols,
|
||||
startSymbolIndex);
|
||||
@@ -872,7 +887,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
|
||||
/* Check and validate PTRS values */
|
||||
struct NR_SetupRelease_PTRS_DownlinkConfig *phaseTrackingRS =
|
||||
bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS;
|
||||
bwp ? bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->phaseTrackingRS : NULL;
|
||||
if (phaseTrackingRS) {
|
||||
bool valid_ptrs_setup = set_dl_ptrs_values(phaseTrackingRS->choice.setup,
|
||||
pdsch_pdu->rbSize,
|
||||
@@ -892,7 +907,9 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu->dci_pdu[pdcch_pdu->numDlDci];
|
||||
pdcch_pdu->numDlDci++;
|
||||
dci_pdu->RNTI = rnti;
|
||||
if (sched_ctrl->coreset->pdcch_DMRS_ScramblingID &&
|
||||
if (sched_ctrl->coreset &&
|
||||
sched_ctrl->search_space &&
|
||||
sched_ctrl->coreset->pdcch_DMRS_ScramblingID &&
|
||||
sched_ctrl->search_space->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_ue_Specific) {
|
||||
dci_pdu->ScramblingId = *sched_ctrl->coreset->pdcch_DMRS_ScramblingID;
|
||||
dci_pdu->ScramblingRNTI = rnti;
|
||||
@@ -909,14 +926,14 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
dci_pdu_rel15_t dci_payload;
|
||||
memset(&dci_payload, 0, sizeof(dci_pdu_rel15_t));
|
||||
// bwp indicator
|
||||
const int n_dl_bwp = UE_info->CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count;
|
||||
AssertFatal(n_dl_bwp == 1,
|
||||
"downlinkBWP_ToAddModList has %d BWP!\n",
|
||||
n_dl_bwp);
|
||||
const int n_dl_bwp = bwp ? UE_info->CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count : 0;
|
||||
AssertFatal(n_dl_bwp <= 1,
|
||||
"downlinkBWP_ToAddModList has %d BWP!\n",
|
||||
n_dl_bwp);
|
||||
// as per table 7.3.1.1.2-1 in 38.212
|
||||
dci_payload.bwp_indicator.val = n_dl_bwp < 4 ? bwp->bwp_Id : bwp->bwp_Id - 1;
|
||||
AssertFatal(bwp->bwp_Dedicated->pdsch_Config->choice.setup->resourceAllocation == NR_PDSCH_Config__resourceAllocation_resourceAllocationType1,
|
||||
"Only frequency resource allocation type 1 is currently supported\n");
|
||||
dci_payload.bwp_indicator.val = bwp ? (n_dl_bwp < 4 ? bwp->bwp_Id : bwp->bwp_Id - 1) : 0;
|
||||
if (bwp) AssertFatal(bwp->bwp_Dedicated->pdsch_Config->choice.setup->resourceAllocation == NR_PDSCH_Config__resourceAllocation_resourceAllocationType1,
|
||||
"Only frequency resource allocation type 1 is currently supported\n");
|
||||
dci_payload.frequency_domain_assignment.val =
|
||||
PRBalloc_to_locationandbandwidth0(
|
||||
pdsch_pdu->rbSize,
|
||||
@@ -933,7 +950,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
dci_payload.pdsch_to_harq_feedback_timing_indicator.val = pucch->timing_indicator; // PDSCH to HARQ TI
|
||||
dci_payload.antenna_ports.val = 0; // nb of cdm groups w/o data 1 and dmrs port 0
|
||||
dci_payload.dmrs_sequence_initialization.val = pdsch_pdu->SCID;
|
||||
LOG_D(MAC,
|
||||
LOG_I(MAC,
|
||||
"%4d.%2d DCI type 1 payload: freq_alloc %d (%d,%d,%d), "
|
||||
"time_alloc %d, vrb to prb %d, mcs %d tb_scaling %d ndi %d rv %d\n",
|
||||
frame,
|
||||
@@ -950,7 +967,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
dci_payload.rv);
|
||||
|
||||
const long f = sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats;
|
||||
const int dci_format = f ? NR_DL_DCI_FORMAT_1_1 : NR_DL_DCI_FORMAT_1_0;
|
||||
const int dci_format = bwp ? (f ? NR_DL_DCI_FORMAT_1_1 : NR_DL_DCI_FORMAT_1_0) : NR_DL_DCI_FORMAT_1_0;
|
||||
const int rnti_type = NR_RNTI_C;
|
||||
|
||||
fill_dci_pdu_rel15(scc,
|
||||
@@ -960,9 +977,9 @@ void nr_schedule_ue_spec(module_id_t module_id,
|
||||
dci_format,
|
||||
rnti_type,
|
||||
pdsch_pdu->BWPSize,
|
||||
bwp->bwp_Id);
|
||||
bwp? bwp->bwp_Id : 0);
|
||||
|
||||
LOG_D(MAC,
|
||||
LOG_I(MAC,
|
||||
"coreset params: FreqDomainResource %llx, start_symbol %d n_symb %d\n",
|
||||
(unsigned long long)pdcch_pdu->FreqDomainResource,
|
||||
pdcch_pdu->StartSymbolIndex,
|
||||
|
||||
@@ -333,7 +333,7 @@ void nr_preprocessor_phytest(module_id_t module_id,
|
||||
__func__,
|
||||
UE_id);
|
||||
|
||||
const bool alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot);
|
||||
const bool alloc = nr_acknack_scheduling(module_id, UE_id, frame, slot,-1);
|
||||
if (!alloc) {
|
||||
LOG_D(MAC,
|
||||
"%s(): could not find PUCCH for UE %d/%04x@%d.%d\n",
|
||||
|
||||
@@ -188,7 +188,7 @@ int allocate_nr_CCEs(gNB_MAC_INST *nr_mac,
|
||||
|
||||
int *cce_list;
|
||||
if(bwp == NULL || bwp->bwp_Id == 0) {
|
||||
cce_list = nr_mac->cce_list[1][0];
|
||||
cce_list = nr_mac->cce_list[0][0];
|
||||
} else {
|
||||
cce_list = nr_mac->cce_list[bwp->bwp_Id][coreset_id];
|
||||
}
|
||||
@@ -514,6 +514,7 @@ void nr_configure_css_dci_initial(nfapi_nr_dl_tti_pdcch_pdu_rel15_t* pdcch_pdu,
|
||||
}
|
||||
|
||||
void config_uldci(const NR_BWP_Uplink_t *ubwp,
|
||||
const NR_ServingCellConfigCommon_t *scc,
|
||||
const nfapi_nr_pusch_pdu_t *pusch_pdu,
|
||||
dci_pdu_rel15_t *dci_pdu_rel15,
|
||||
int dci_format,
|
||||
@@ -521,7 +522,9 @@ void config_uldci(const NR_BWP_Uplink_t *ubwp,
|
||||
uint8_t tpc,
|
||||
int n_ubwp,
|
||||
int bwp_id) {
|
||||
const int bw = NRRIV2BW(ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
const int bw = NRRIV2BW(ubwp ?
|
||||
ubwp->bwp_Common->genericParameters.locationAndBandwidth :
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
dci_pdu_rel15->frequency_domain_assignment.val =
|
||||
PRBalloc_to_locationandbandwidth0(pusch_pdu->rb_size, pusch_pdu->rb_start, bw);
|
||||
dci_pdu_rel15->time_domain_assignment.val = time_domain_assignment;
|
||||
@@ -531,8 +534,8 @@ void config_uldci(const NR_BWP_Uplink_t *ubwp,
|
||||
dci_pdu_rel15->rv = pusch_pdu->pusch_data.rv_index;
|
||||
dci_pdu_rel15->harq_pid = pusch_pdu->pusch_data.harq_process_id;
|
||||
dci_pdu_rel15->tpc = tpc;
|
||||
AssertFatal(ubwp->bwp_Dedicated->pusch_Config->choice.setup->resourceAllocation == NR_PUSCH_Config__resourceAllocation_resourceAllocationType1,
|
||||
"Only frequency resource allocation type 1 is currently supported\n");
|
||||
if (ubwp) AssertFatal(ubwp->bwp_Dedicated->pusch_Config->choice.setup->resourceAllocation == NR_PUSCH_Config__resourceAllocation_resourceAllocationType1,
|
||||
"Only frequency resource allocation type 1 is currently supported\n");
|
||||
switch (dci_format) {
|
||||
case NR_UL_DCI_FORMAT_0_0:
|
||||
dci_pdu_rel15->format_indicator = 0;
|
||||
@@ -542,7 +545,11 @@ void config_uldci(const NR_BWP_Uplink_t *ubwp,
|
||||
// bwp indicator as per table 7.3.1.1.2-1 in 38.212
|
||||
dci_pdu_rel15->bwp_indicator.val = n_ubwp < 4 ? bwp_id : bwp_id - 1;
|
||||
// SRS resource indicator
|
||||
if (ubwp->bwp_Dedicated->pusch_Config->choice.setup->txConfig != NULL) {
|
||||
if (ubwp &&
|
||||
ubwp->bwp_Dedicated &&
|
||||
ubwp->bwp_Dedicated->pusch_Config &&
|
||||
ubwp->bwp_Dedicated->pusch_Config->choice.setup &&
|
||||
ubwp->bwp_Dedicated->pusch_Config->choice.setup->txConfig != NULL) {
|
||||
AssertFatal(*ubwp->bwp_Dedicated->pusch_Config->choice.setup->txConfig == NR_PUSCH_Config__txConfig_codebook,
|
||||
"Non Codebook configuration non supported\n");
|
||||
dci_pdu_rel15->srs_resource_indicator.val = 0; // taking resource 0 for SRS
|
||||
@@ -568,70 +575,79 @@ void config_uldci(const NR_BWP_Uplink_t *ubwp,
|
||||
dci_pdu_rel15->rv);
|
||||
}
|
||||
|
||||
const int default_pucch_fmt[] = {0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1};
|
||||
const int default_pucch_firstsymb[] = {12,12,12,10,10,10,10,4,4,4,4,0,0,0,0,0};
|
||||
const int default_pucch_numbsymb[] = {2,2,2,2,4,4,4,4,10,10,10,10,14,14,14,14,14};
|
||||
const int default_pucch_prboffset[] = {0,0,3,0,0,2,4,0,0,2,4,0,0,2,4,-1};
|
||||
const int default_pucch_csset[] = {2,3,3,2,4,4,4,2,4,4,4,2,4,4,4,4};
|
||||
|
||||
int nr_get_default_pucch_res(int pucch_ResourceCommon) {
|
||||
|
||||
AssertFatal(pucch_ResourceCommon>=0 && pucch_ResourceCommon < 16, "illegal pucch_ResourceCommon %d\n",pucch_ResourceCommon);
|
||||
|
||||
return(default_pucch_csset[pucch_ResourceCommon]);
|
||||
}
|
||||
void nr_configure_pdcch(nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu,
|
||||
NR_SearchSpace_t *ss,
|
||||
NR_ControlResourceSet_t *coreset,
|
||||
NR_ServingCellConfigCommon_t *scc,
|
||||
NR_BWP_Downlink_t *bwp)
|
||||
{
|
||||
if (bwp) { // This is not the InitialBWP
|
||||
pdcch_pdu->BWPSize = NRRIV2BW(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
pdcch_pdu->BWPStart = NRRIV2PRBOFFSET(bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
pdcch_pdu->SubcarrierSpacing = bwp->bwp_Common->genericParameters.subcarrierSpacing;
|
||||
pdcch_pdu->CyclicPrefix = (bwp->bwp_Common->genericParameters.cyclicPrefix==NULL) ? 0 : *bwp->bwp_Common->genericParameters.cyclicPrefix;
|
||||
|
||||
// first symbol
|
||||
//AssertFatal(pdcch_scs==kHz15, "PDCCH SCS above 15kHz not allowed if a symbol above 2 is monitored");
|
||||
int sps = bwp->bwp_Common->genericParameters.cyclicPrefix == NULL ? 14 : 12;
|
||||
|
||||
AssertFatal(ss->monitoringSymbolsWithinSlot!=NULL,"ss->monitoringSymbolsWithinSlot is null\n");
|
||||
AssertFatal(ss->monitoringSymbolsWithinSlot->buf!=NULL,"ss->monitoringSymbolsWithinSlot->buf is null\n");
|
||||
|
||||
// for SPS=14 8 MSBs in positions 13 downto 6
|
||||
uint16_t monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) |
|
||||
(ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps));
|
||||
|
||||
for (int i=0; i<sps; i++) {
|
||||
if ((monitoringSymbolsWithinSlot>>(sps-1-i))&1) {
|
||||
pdcch_pdu->StartSymbolIndex=i;
|
||||
break;
|
||||
}
|
||||
NR_BWP_t *genericParameters = bwp ? &bwp->bwp_Common->genericParameters : &scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters;
|
||||
|
||||
pdcch_pdu->BWPSize = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);
|
||||
pdcch_pdu->BWPStart = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);
|
||||
pdcch_pdu->SubcarrierSpacing = genericParameters->subcarrierSpacing;
|
||||
pdcch_pdu->CyclicPrefix = genericParameters->cyclicPrefix ? *genericParameters->cyclicPrefix:0;
|
||||
|
||||
// first symbol
|
||||
//AssertFatal(pdcch_scs==kHz15, "PDCCH SCS above 15kHz not allowed if a symbol above 2 is monitored");
|
||||
int sps = genericParameters->cyclicPrefix == NULL ? 14 : 12;
|
||||
|
||||
AssertFatal(ss->monitoringSymbolsWithinSlot!=NULL,"ss->monitoringSymbolsWithinSlot is null\n");
|
||||
AssertFatal(ss->monitoringSymbolsWithinSlot->buf!=NULL,"ss->monitoringSymbolsWithinSlot->buf is null\n");
|
||||
|
||||
// for SPS=14 8 MSBs in positions 13 downto 6
|
||||
uint16_t monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) |
|
||||
(ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps));
|
||||
|
||||
for (int i=0; i<sps; i++) {
|
||||
if ((monitoringSymbolsWithinSlot>>(sps-1-i))&1) {
|
||||
pdcch_pdu->StartSymbolIndex=i;
|
||||
break;
|
||||
}
|
||||
|
||||
pdcch_pdu->DurationSymbols = coreset->duration;
|
||||
|
||||
for (int i=0;i<6;i++)
|
||||
pdcch_pdu->FreqDomainResource[i] = coreset->frequencyDomainResources.buf[i];
|
||||
|
||||
|
||||
//cce-REG-MappingType
|
||||
pdcch_pdu->CceRegMappingType = coreset->cce_REG_MappingType.present == NR_ControlResourceSet__cce_REG_MappingType_PR_interleaved?
|
||||
NFAPI_NR_CCE_REG_MAPPING_INTERLEAVED : NFAPI_NR_CCE_REG_MAPPING_NON_INTERLEAVED;
|
||||
|
||||
if (pdcch_pdu->CceRegMappingType == NFAPI_NR_CCE_REG_MAPPING_INTERLEAVED) {
|
||||
pdcch_pdu->RegBundleSize = (coreset->cce_REG_MappingType.choice.interleaved->reg_BundleSize == NR_ControlResourceSet__cce_REG_MappingType__interleaved__reg_BundleSize_n6) ? 6 : (2+coreset->cce_REG_MappingType.choice.interleaved->reg_BundleSize);
|
||||
pdcch_pdu->InterleaverSize = (coreset->cce_REG_MappingType.choice.interleaved->interleaverSize==NR_ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n6) ? 6 : (2+coreset->cce_REG_MappingType.choice.interleaved->interleaverSize);
|
||||
AssertFatal(scc->physCellId != NULL,"scc->physCellId is null\n");
|
||||
pdcch_pdu->ShiftIndex = coreset->cce_REG_MappingType.choice.interleaved->shiftIndex != NULL ? *coreset->cce_REG_MappingType.choice.interleaved->shiftIndex : *scc->physCellId;
|
||||
}
|
||||
else {
|
||||
pdcch_pdu->RegBundleSize = 0;
|
||||
pdcch_pdu->InterleaverSize = 0;
|
||||
pdcch_pdu->ShiftIndex = 0;
|
||||
}
|
||||
|
||||
if(coreset->controlResourceSetId == 0) {
|
||||
pdcch_pdu->CoreSetType = NFAPI_NR_CSET_CONFIG_MIB_SIB1;
|
||||
} else{
|
||||
pdcch_pdu->CoreSetType = NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG;
|
||||
}
|
||||
|
||||
//precoderGranularity
|
||||
pdcch_pdu->precoderGranularity = coreset->precoderGranularity;
|
||||
}
|
||||
else { // this is for InitialBWP
|
||||
AssertFatal(1==0,"Fill in InitialBWP PDCCH configuration\n");
|
||||
|
||||
pdcch_pdu->DurationSymbols = coreset->duration;
|
||||
|
||||
for (int i=0;i<6;i++)
|
||||
pdcch_pdu->FreqDomainResource[i] = coreset->frequencyDomainResources.buf[i];
|
||||
|
||||
|
||||
//cce-REG-MappingType
|
||||
pdcch_pdu->CceRegMappingType = coreset->cce_REG_MappingType.present == NR_ControlResourceSet__cce_REG_MappingType_PR_interleaved?
|
||||
NFAPI_NR_CCE_REG_MAPPING_INTERLEAVED : NFAPI_NR_CCE_REG_MAPPING_NON_INTERLEAVED;
|
||||
|
||||
if (pdcch_pdu->CceRegMappingType == NFAPI_NR_CCE_REG_MAPPING_INTERLEAVED) {
|
||||
pdcch_pdu->RegBundleSize = (coreset->cce_REG_MappingType.choice.interleaved->reg_BundleSize == NR_ControlResourceSet__cce_REG_MappingType__interleaved__reg_BundleSize_n6) ? 6 : (2+coreset->cce_REG_MappingType.choice.interleaved->reg_BundleSize);
|
||||
pdcch_pdu->InterleaverSize = (coreset->cce_REG_MappingType.choice.interleaved->interleaverSize==NR_ControlResourceSet__cce_REG_MappingType__interleaved__interleaverSize_n6) ? 6 : (2+coreset->cce_REG_MappingType.choice.interleaved->interleaverSize);
|
||||
AssertFatal(scc->physCellId != NULL,"scc->physCellId is null\n");
|
||||
pdcch_pdu->ShiftIndex = coreset->cce_REG_MappingType.choice.interleaved->shiftIndex != NULL ? *coreset->cce_REG_MappingType.choice.interleaved->shiftIndex : *scc->physCellId;
|
||||
}
|
||||
else {
|
||||
pdcch_pdu->RegBundleSize = 0;
|
||||
pdcch_pdu->InterleaverSize = 0;
|
||||
pdcch_pdu->ShiftIndex = 0;
|
||||
}
|
||||
|
||||
if(coreset->controlResourceSetId == 0) {
|
||||
pdcch_pdu->CoreSetType = NFAPI_NR_CSET_CONFIG_MIB_SIB1;
|
||||
} else{
|
||||
pdcch_pdu->CoreSetType = NFAPI_NR_CSET_CONFIG_PDCCH_CONFIG;
|
||||
}
|
||||
|
||||
//precoderGranularity
|
||||
pdcch_pdu->precoderGranularity = coreset->precoderGranularity;
|
||||
}
|
||||
|
||||
|
||||
@@ -644,7 +660,8 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu,
|
||||
uint8_t pucch_resource,
|
||||
uint16_t O_csi,
|
||||
uint16_t O_ack,
|
||||
uint8_t O_sr) {
|
||||
uint8_t O_sr,
|
||||
int r_pucch) {
|
||||
|
||||
NR_PUCCH_Config_t *pucch_Config;
|
||||
NR_PUCCH_Resource_t *pucchres;
|
||||
@@ -669,7 +686,7 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu,
|
||||
id0 = pusch_Config->dmrs_UplinkForPUSCH_MappingTypeA->choice.setup->transformPrecodingDisabled->scramblingID0;
|
||||
else if (bwp && pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB != NULL)
|
||||
id0 = pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->transformPrecodingDisabled->scramblingID0;
|
||||
else id0 = *scc->physCellId;
|
||||
else id0 = scc->physCellId;
|
||||
|
||||
NR_PUCCH_ConfigCommon_t *pucch_ConfigCommon = bwp ?
|
||||
bwp->bwp_Common->pucch_ConfigCommon->choice.setup :
|
||||
@@ -700,153 +717,177 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu,
|
||||
else
|
||||
pucch_pdu->hopping_id = *scc->physCellId;
|
||||
NR_BWP_t *genericParameters = bwp ?
|
||||
&bwp->bwp_Common->genericParameters.locationAndBandwidth:
|
||||
&bwp->bwp_Common->genericParameters:
|
||||
&scc->uplinkConfigCommon->initialUplinkBWP->genericParameters;
|
||||
pucch_pdu->bwp_size = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);
|
||||
pucch_pdu->bwp_start = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth,MAX_BWP_SIZE);
|
||||
pucch_pdu->subcarrier_spacing = genericParameters->subcarrierSpacing;
|
||||
pucch_pdu->cyclic_prefix = (genericParameters->cyclicPrefix==NULL) ? 0 : *genericParameters->cyclicPrefix;
|
||||
AssertFatal(CellGroup!=NULL, "CellGroup cannot be null\n");
|
||||
pucch_Config = bwp ?
|
||||
bwp->bwp_Dedicated->pucch_Config->choice.setup:
|
||||
CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup;
|
||||
|
||||
AssertFatal(pucch_Config->resourceSetToAddModList!=NULL,
|
||||
"PUCCH resourceSetToAddModList is null\n");
|
||||
|
||||
n_set = pucch_Config->resourceSetToAddModList->list.count;
|
||||
AssertFatal(n_set>0,"PUCCH resourceSetToAddModList is empty\n");
|
||||
|
||||
LOG_D(MAC, "UCI n_set= %d\n", n_set);
|
||||
|
||||
N2 = 2;
|
||||
// procedure to select pucch resource id from resource sets according to
|
||||
// number of uci bits and pucch resource indicator pucch_resource
|
||||
// ( see table 9.2.3.2 in 38.213)
|
||||
for (int i=0; i<n_set; i++) {
|
||||
pucchresset = pucch_Config->resourceSetToAddModList->list.array[i];
|
||||
n_list = pucchresset->resourceList.list.count;
|
||||
if (pucchresset->pucch_ResourceSetId == 0 && O_uci<3) {
|
||||
if (pucch_resource < n_list)
|
||||
resource_id = pucchresset->resourceList.list.array[pucch_resource];
|
||||
else
|
||||
AssertFatal(1==0,"Couldn't fine pucch resource indicator %d in PUCCH resource set %d for %d UCI bits",pucch_resource,i,O_uci);
|
||||
}
|
||||
if (pucchresset->pucch_ResourceSetId == 1 && O_uci>2) {
|
||||
if (r_pucch<0){
|
||||
// we have either a dedicated BWP or Dedicated PUCCH configuration on InitialBWP
|
||||
pucch_Config = bwp ?
|
||||
bwp->bwp_Dedicated->pucch_Config->choice.setup:
|
||||
CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup;
|
||||
|
||||
AssertFatal(pucch_Config->resourceSetToAddModList!=NULL,
|
||||
"PUCCH resourceSetToAddModList is null\n");
|
||||
|
||||
n_set = pucch_Config->resourceSetToAddModList->list.count;
|
||||
AssertFatal(n_set>0,"PUCCH resourceSetToAddModList is empty\n");
|
||||
|
||||
LOG_D(MAC, "UCI n_set= %d\n", n_set);
|
||||
|
||||
N2 = 2;
|
||||
// procedure to select pucch resource id from resource sets according to
|
||||
// number of uci bits and pucch resource indicator pucch_resource
|
||||
// ( see table 9.2.3.2 in 38.213)
|
||||
for (int i=0; i<n_set; i++) {
|
||||
pucchresset = pucch_Config->resourceSetToAddModList->list.array[i];
|
||||
n_list = pucchresset->resourceList.list.count;
|
||||
if (pucchresset->pucch_ResourceSetId == 0 && O_uci<3) {
|
||||
if (pucch_resource < n_list)
|
||||
resource_id = pucchresset->resourceList.list.array[pucch_resource];
|
||||
else
|
||||
AssertFatal(1==0,"Couldn't fine pucch resource indicator %d in PUCCH resource set %d for %d UCI bits",pucch_resource,i,O_uci);
|
||||
}
|
||||
if (pucchresset->pucch_ResourceSetId == 1 && O_uci>2) {
|
||||
#if (NR_RRC_VERSION >= MAKE_VERSION(16, 0, 0))
|
||||
N3 = pucchresset->maxPayloadSize!= NULL ? *pucchresset->maxPayloadSize : 1706;
|
||||
N3 = pucchresset->maxPayloadSize!= NULL ? *pucchresset->maxPayloadSize : 1706;
|
||||
#else
|
||||
N3 = pucchresset->maxPayloadMinus1!= NULL ? *pucchresset->maxPayloadMinus1 : 1706;
|
||||
N3 = pucchresset->maxPayloadMinus1!= NULL ? *pucchresset->maxPayloadMinus1 : 1706;
|
||||
#endif
|
||||
if (N2<O_uci && N3>O_uci) {
|
||||
if (pucch_resource < n_list)
|
||||
resource_id = pucchresset->resourceList.list.array[pucch_resource];
|
||||
else
|
||||
AssertFatal(1==0,"Couldn't fine pucch resource indicator %d in PUCCH resource set %d for %d UCI bits",pucch_resource,i,O_uci);
|
||||
if (N2<O_uci && N3>O_uci) {
|
||||
if (pucch_resource < n_list)
|
||||
resource_id = pucchresset->resourceList.list.array[pucch_resource];
|
||||
else
|
||||
AssertFatal(1==0,"Couldn't fine pucch resource indicator %d in PUCCH resource set %d for %d UCI bits",pucch_resource,i,O_uci);
|
||||
}
|
||||
else N2 = N3;
|
||||
}
|
||||
}
|
||||
|
||||
AssertFatal(resource_id!=NULL,"Couldn-t find any matching PUCCH resource in the PUCCH resource sets");
|
||||
|
||||
AssertFatal(pucch_Config->resourceToAddModList!=NULL,
|
||||
"PUCCH resourceToAddModList is null\n");
|
||||
|
||||
n_list = pucch_Config->resourceToAddModList->list.count;
|
||||
AssertFatal(n_list>0,"PUCCH resourceToAddModList is empty\n");
|
||||
|
||||
// going through the list of PUCCH resources to find the one indexed by resource_id
|
||||
for (int i=0; i<n_list; i++) {
|
||||
pucchres = pucch_Config->resourceToAddModList->list.array[i];
|
||||
if (pucchres->pucch_ResourceId == *resource_id) {
|
||||
res_found = 1;
|
||||
pucch_pdu->prb_start = pucchres->startingPRB;
|
||||
pucch_pdu->rnti = rnti;
|
||||
// FIXME why there is only one frequency hopping flag
|
||||
// what about inter slot frequency hopping?
|
||||
pucch_pdu->freq_hop_flag = pucchres->intraSlotFrequencyHopping!= NULL ? 1 : 0;
|
||||
pucch_pdu->second_hop_prb = pucchres->secondHopPRB!= NULL ? *pucchres->secondHopPRB : 0;
|
||||
switch(pucchres->format.present) {
|
||||
case NR_PUCCH_Resource__format_PR_format0 :
|
||||
pucch_pdu->format_type = 0;
|
||||
pucch_pdu->initial_cyclic_shift = pucchres->format.choice.format0->initialCyclicShift;
|
||||
pucch_pdu->nr_of_symbols = pucchres->format.choice.format0->nrofSymbols;
|
||||
pucch_pdu->start_symbol_index = pucchres->format.choice.format0->startingSymbolIndex;
|
||||
pucch_pdu->sr_flag = O_sr;
|
||||
break;
|
||||
case NR_PUCCH_Resource__format_PR_format1 :
|
||||
pucch_pdu->format_type = 1;
|
||||
pucch_pdu->initial_cyclic_shift = pucchres->format.choice.format1->initialCyclicShift;
|
||||
pucch_pdu->nr_of_symbols = pucchres->format.choice.format1->nrofSymbols;
|
||||
pucch_pdu->start_symbol_index = pucchres->format.choice.format1->startingSymbolIndex;
|
||||
pucch_pdu->time_domain_occ_idx = pucchres->format.choice.format1->timeDomainOCC;
|
||||
pucch_pdu->sr_flag = O_sr;
|
||||
break;
|
||||
case NR_PUCCH_Resource__format_PR_format2 :
|
||||
pucch_pdu->format_type = 2;
|
||||
pucch_pdu->nr_of_symbols = pucchres->format.choice.format2->nrofSymbols;
|
||||
pucch_pdu->start_symbol_index = pucchres->format.choice.format2->startingSymbolIndex;
|
||||
pucch_pdu->data_scrambling_id = pusch_id!= NULL ? *pusch_id : *scc->physCellId;
|
||||
pucch_pdu->dmrs_scrambling_id = id0!= NULL ? *id0 : *scc->physCellId;
|
||||
pucch_pdu->prb_size = compute_pucch_prb_size(2,pucchres->format.choice.format2->nrofPRBs,
|
||||
O_uci+O_sr,O_csi,pucch_Config->format2->choice.setup->maxCodeRate,
|
||||
2,pucchres->format.choice.format2->nrofSymbols,8);
|
||||
pucch_pdu->bit_len_csi_part1 = O_csi;
|
||||
break;
|
||||
case NR_PUCCH_Resource__format_PR_format3 :
|
||||
pucch_pdu->format_type = 3;
|
||||
pucch_pdu->nr_of_symbols = pucchres->format.choice.format3->nrofSymbols;
|
||||
pucch_pdu->start_symbol_index = pucchres->format.choice.format3->startingSymbolIndex;
|
||||
pucch_pdu->data_scrambling_id = pusch_id!= NULL ? *pusch_id : *scc->physCellId;
|
||||
if (pucch_Config->format3 == NULL) {
|
||||
pucch_pdu->pi_2bpsk = 0;
|
||||
pucch_pdu->add_dmrs_flag = 0;
|
||||
}
|
||||
else {
|
||||
pucchfmt = pucch_Config->format3->choice.setup;
|
||||
pucch_pdu->pi_2bpsk = pucchfmt->pi2BPSK!= NULL ? 1 : 0;
|
||||
pucch_pdu->add_dmrs_flag = pucchfmt->additionalDMRS!= NULL ? 1 : 0;
|
||||
}
|
||||
int f3_dmrs_symbols;
|
||||
if (pucchres->format.choice.format3->nrofSymbols==4)
|
||||
f3_dmrs_symbols = 1<<pucch_pdu->freq_hop_flag;
|
||||
else {
|
||||
if(pucchres->format.choice.format3->nrofSymbols<10)
|
||||
f3_dmrs_symbols = 2;
|
||||
else
|
||||
f3_dmrs_symbols = 2<<pucch_pdu->add_dmrs_flag;
|
||||
}
|
||||
pucch_pdu->prb_size = compute_pucch_prb_size(3,pucchres->format.choice.format3->nrofPRBs,
|
||||
O_uci+O_sr,O_csi,pucch_Config->format3->choice.setup->maxCodeRate,
|
||||
2-pucch_pdu->pi_2bpsk,pucchres->format.choice.format3->nrofSymbols-f3_dmrs_symbols,12);
|
||||
pucch_pdu->bit_len_csi_part1 = O_csi;
|
||||
break;
|
||||
case NR_PUCCH_Resource__format_PR_format4 :
|
||||
pucch_pdu->format_type = 4;
|
||||
pucch_pdu->nr_of_symbols = pucchres->format.choice.format4->nrofSymbols;
|
||||
pucch_pdu->start_symbol_index = pucchres->format.choice.format4->startingSymbolIndex;
|
||||
pucch_pdu->pre_dft_occ_len = pucchres->format.choice.format4->occ_Length;
|
||||
pucch_pdu->pre_dft_occ_idx = pucchres->format.choice.format4->occ_Index;
|
||||
pucch_pdu->data_scrambling_id = pusch_id!= NULL ? *pusch_id : *scc->physCellId;
|
||||
if (pucch_Config->format3 == NULL) {
|
||||
pucch_pdu->pi_2bpsk = 0;
|
||||
pucch_pdu->add_dmrs_flag = 0;
|
||||
}
|
||||
else {
|
||||
pucchfmt = pucch_Config->format3->choice.setup;
|
||||
pucch_pdu->pi_2bpsk = pucchfmt->pi2BPSK!= NULL ? 1 : 0;
|
||||
pucch_pdu->add_dmrs_flag = pucchfmt->additionalDMRS!= NULL ? 1 : 0;
|
||||
}
|
||||
pucch_pdu->bit_len_csi_part1 = O_csi;
|
||||
break;
|
||||
default :
|
||||
AssertFatal(1==0,"Undefined PUCCH format \n");
|
||||
}
|
||||
}
|
||||
}
|
||||
AssertFatal(res_found==1,"No PUCCH resource found corresponding to id %ld\n",*resource_id);
|
||||
}
|
||||
else { // this is the default PUCCH configuration, PUCCH format 0 or 1
|
||||
int rsetindex = *scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->pucch_ResourceCommon;
|
||||
int prboffset = r_pucch/default_pucch_csset[rsetindex];
|
||||
int prboffsetm8 = (r_pucch-8)/default_pucch_csset[rsetindex];
|
||||
pucch_pdu->prb_start = (r_pucch>>3)==0 ?
|
||||
default_pucch_prboffset[rsetindex] + prboffset:
|
||||
pucch_pdu->bwp_size-1-default_pucch_prboffset[rsetindex]-prboffsetm8;
|
||||
pucch_pdu->rnti = rnti;
|
||||
pucch_pdu->freq_hop_flag = 1;
|
||||
pucch_pdu->second_hop_prb = (r_pucch>>3)==0?
|
||||
pucch_pdu->bwp_size-1-default_pucch_prboffset[rsetindex]-prboffset:
|
||||
default_pucch_prboffset[rsetindex] + prboffsetm8;
|
||||
pucch_pdu->format_type = default_pucch_fmt[rsetindex];
|
||||
pucch_pdu->initial_cyclic_shift = r_pucch%default_pucch_csset[rsetindex];
|
||||
if (rsetindex==3||rsetindex==7||rsetindex==11) pucch_pdu->initial_cyclic_shift*=6;
|
||||
else if (rsetindex==1||rsetindex==2) pucch_pdu->initial_cyclic_shift*=3;
|
||||
else pucch_pdu->initial_cyclic_shift*=4;
|
||||
pucch_pdu->nr_of_symbols = default_pucch_numbsymb[rsetindex];
|
||||
pucch_pdu->start_symbol_index = default_pucch_firstsymb[rsetindex];
|
||||
if (pucch_pdu->format_type == 1) pucch_pdu->time_domain_occ_idx = 0; // check this!!
|
||||
pucch_pdu->sr_flag = O_sr;
|
||||
}
|
||||
else N2 = N3;
|
||||
}
|
||||
}
|
||||
|
||||
AssertFatal(resource_id!=NULL,"Couldn-t find any matching PUCCH resource in the PUCCH resource sets");
|
||||
|
||||
AssertFatal(pucch_Config->resourceToAddModList!=NULL,
|
||||
"PUCCH resourceToAddModList is null\n");
|
||||
|
||||
n_list = pucch_Config->resourceToAddModList->list.count;
|
||||
AssertFatal(n_list>0,"PUCCH resourceToAddModList is empty\n");
|
||||
|
||||
// going through the list of PUCCH resources to find the one indexed by resource_id
|
||||
for (int i=0; i<n_list; i++) {
|
||||
pucchres = pucch_Config->resourceToAddModList->list.array[i];
|
||||
if (pucchres->pucch_ResourceId == *resource_id) {
|
||||
res_found = 1;
|
||||
pucch_pdu->prb_start = pucchres->startingPRB;
|
||||
pucch_pdu->rnti = rnti;
|
||||
// FIXME why there is only one frequency hopping flag
|
||||
// what about inter slot frequency hopping?
|
||||
pucch_pdu->freq_hop_flag = pucchres->intraSlotFrequencyHopping!= NULL ? 1 : 0;
|
||||
pucch_pdu->second_hop_prb = pucchres->secondHopPRB!= NULL ? *pucchres->secondHopPRB : 0;
|
||||
switch(pucchres->format.present) {
|
||||
case NR_PUCCH_Resource__format_PR_format0 :
|
||||
pucch_pdu->format_type = 0;
|
||||
pucch_pdu->initial_cyclic_shift = pucchres->format.choice.format0->initialCyclicShift;
|
||||
pucch_pdu->nr_of_symbols = pucchres->format.choice.format0->nrofSymbols;
|
||||
pucch_pdu->start_symbol_index = pucchres->format.choice.format0->startingSymbolIndex;
|
||||
pucch_pdu->sr_flag = O_sr;
|
||||
break;
|
||||
case NR_PUCCH_Resource__format_PR_format1 :
|
||||
pucch_pdu->format_type = 1;
|
||||
pucch_pdu->initial_cyclic_shift = pucchres->format.choice.format1->initialCyclicShift;
|
||||
pucch_pdu->nr_of_symbols = pucchres->format.choice.format1->nrofSymbols;
|
||||
pucch_pdu->start_symbol_index = pucchres->format.choice.format1->startingSymbolIndex;
|
||||
pucch_pdu->time_domain_occ_idx = pucchres->format.choice.format1->timeDomainOCC;
|
||||
pucch_pdu->sr_flag = O_sr;
|
||||
break;
|
||||
case NR_PUCCH_Resource__format_PR_format2 :
|
||||
pucch_pdu->format_type = 2;
|
||||
pucch_pdu->nr_of_symbols = pucchres->format.choice.format2->nrofSymbols;
|
||||
pucch_pdu->start_symbol_index = pucchres->format.choice.format2->startingSymbolIndex;
|
||||
pucch_pdu->data_scrambling_id = pusch_id!= NULL ? *pusch_id : *scc->physCellId;
|
||||
pucch_pdu->dmrs_scrambling_id = id0!= NULL ? *id0 : *scc->physCellId;
|
||||
pucch_pdu->prb_size = compute_pucch_prb_size(2,pucchres->format.choice.format2->nrofPRBs,
|
||||
O_uci+O_sr,O_csi,pucch_Config->format2->choice.setup->maxCodeRate,
|
||||
2,pucchres->format.choice.format2->nrofSymbols,8);
|
||||
pucch_pdu->bit_len_csi_part1 = O_csi;
|
||||
break;
|
||||
case NR_PUCCH_Resource__format_PR_format3 :
|
||||
pucch_pdu->format_type = 3;
|
||||
pucch_pdu->nr_of_symbols = pucchres->format.choice.format3->nrofSymbols;
|
||||
pucch_pdu->start_symbol_index = pucchres->format.choice.format3->startingSymbolIndex;
|
||||
pucch_pdu->data_scrambling_id = pusch_id!= NULL ? *pusch_id : *scc->physCellId;
|
||||
if (pucch_Config->format3 == NULL) {
|
||||
pucch_pdu->pi_2bpsk = 0;
|
||||
pucch_pdu->add_dmrs_flag = 0;
|
||||
}
|
||||
else {
|
||||
pucchfmt = pucch_Config->format3->choice.setup;
|
||||
pucch_pdu->pi_2bpsk = pucchfmt->pi2BPSK!= NULL ? 1 : 0;
|
||||
pucch_pdu->add_dmrs_flag = pucchfmt->additionalDMRS!= NULL ? 1 : 0;
|
||||
}
|
||||
int f3_dmrs_symbols;
|
||||
if (pucchres->format.choice.format3->nrofSymbols==4)
|
||||
f3_dmrs_symbols = 1<<pucch_pdu->freq_hop_flag;
|
||||
else {
|
||||
if(pucchres->format.choice.format3->nrofSymbols<10)
|
||||
f3_dmrs_symbols = 2;
|
||||
else
|
||||
f3_dmrs_symbols = 2<<pucch_pdu->add_dmrs_flag;
|
||||
}
|
||||
pucch_pdu->prb_size = compute_pucch_prb_size(3,pucchres->format.choice.format3->nrofPRBs,
|
||||
O_uci+O_sr,O_csi,pucch_Config->format3->choice.setup->maxCodeRate,
|
||||
2-pucch_pdu->pi_2bpsk,pucchres->format.choice.format3->nrofSymbols-f3_dmrs_symbols,12);
|
||||
pucch_pdu->bit_len_csi_part1 = O_csi;
|
||||
break;
|
||||
case NR_PUCCH_Resource__format_PR_format4 :
|
||||
pucch_pdu->format_type = 4;
|
||||
pucch_pdu->nr_of_symbols = pucchres->format.choice.format4->nrofSymbols;
|
||||
pucch_pdu->start_symbol_index = pucchres->format.choice.format4->startingSymbolIndex;
|
||||
pucch_pdu->pre_dft_occ_len = pucchres->format.choice.format4->occ_Length;
|
||||
pucch_pdu->pre_dft_occ_idx = pucchres->format.choice.format4->occ_Index;
|
||||
pucch_pdu->data_scrambling_id = pusch_id!= NULL ? *pusch_id : *scc->physCellId;
|
||||
if (pucch_Config->format3 == NULL) {
|
||||
pucch_pdu->pi_2bpsk = 0;
|
||||
pucch_pdu->add_dmrs_flag = 0;
|
||||
}
|
||||
else {
|
||||
pucchfmt = pucch_Config->format3->choice.setup;
|
||||
pucch_pdu->pi_2bpsk = pucchfmt->pi2BPSK!= NULL ? 1 : 0;
|
||||
pucch_pdu->add_dmrs_flag = pucchfmt->additionalDMRS!= NULL ? 1 : 0;
|
||||
}
|
||||
pucch_pdu->bit_len_csi_part1 = O_csi;
|
||||
break;
|
||||
default :
|
||||
AssertFatal(1==0,"Undefined PUCCH format \n");
|
||||
}
|
||||
}
|
||||
}
|
||||
AssertFatal(res_found==1,"No PUCCH resource found corresponding to id %ld\n",*resource_id);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1206,30 +1247,33 @@ void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc,
|
||||
switch (rnti_type) {
|
||||
case NR_RNTI_C:
|
||||
// indicating a DL DCI format 1bit
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->format_indicator & 1) << (dci_size - pos++);
|
||||
pos=1;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->format_indicator & 1) << (dci_size - pos);
|
||||
// Freq domain assignment max 16 bit
|
||||
fsize = (int)ceil(log2((N_RB * (N_RB + 1)) >> 1));
|
||||
for (int i = 0; i < fsize; i++)
|
||||
*dci_pdu |= ((dci_pdu_rel15->frequency_domain_assignment.val >> (fsize - i - 1)) & 1) << (dci_size - pos++);
|
||||
pos+=fsize;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->frequency_domain_assignment.val & ((1 << fsize) - 1)) << (dci_size - pos);
|
||||
// Time domain assignment 4bit
|
||||
for (int i = 0; i < 4; i++)
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->time_domain_assignment.val >> (3 - i)) & 1) << (dci_size - pos++);
|
||||
pos += 4;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->time_domain_assignment.val & ((1 << 4) - 1)) << (dci_size - pos);
|
||||
// Frequency hopping flag – 1 bit
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->frequency_hopping_flag.val & 1) << (dci_size - pos++);
|
||||
pos++;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->frequency_hopping_flag.val & 1) << (dci_size - pos);
|
||||
// MCS 5 bit
|
||||
for (int i = 0; i < 5; i++)
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->mcs >> (4 - i)) & 1) << (dci_size - pos++);
|
||||
pos+=5;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->mcs & 0x1f) << (dci_size - pos);
|
||||
// New data indicator 1bit
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->ndi & 1) << (dci_size - pos++);
|
||||
pos++;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->ndi & 1) << (dci_size - pos);
|
||||
// Redundancy version 2bit
|
||||
for (int i = 0; i < 2; i++)
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->rv >> (1 - i)) & 1) << (dci_size - pos++);
|
||||
pos+=2;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->rv & 0x3) << (dci_size - pos);
|
||||
// HARQ process number 4bit
|
||||
for (int i = 0; i < 4; i++)
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->harq_pid >> (3 - i)) & 1) << (dci_size - pos++);
|
||||
pos+=4;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->harq_pid & 0xf) << (dci_size - pos);
|
||||
// TPC command for scheduled PUSCH – 2 bits
|
||||
for (int i = 0; i < 2; i++)
|
||||
*dci_pdu |= (((uint64_t)dci_pdu_rel15->tpc >> (1 - i)) & 1) << (dci_size - pos++);
|
||||
pos+=2;
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->tpc & 0x3) << (dci_size - pos);
|
||||
// Padding bits
|
||||
for (int a = pos; a < 32; a++)
|
||||
*dci_pdu |= ((uint64_t)dci_pdu_rel15->padding & 1) << (dci_size - pos++);
|
||||
@@ -1666,6 +1710,8 @@ int add_new_nr_ue(module_id_t mod_idP, rnti_t rntiP, NR_CellGroupConfig_t *CellG
|
||||
int UE_id = i;
|
||||
UE_info->num_UEs++;
|
||||
UE_info->active[UE_id] = true;
|
||||
if (CellGroup) UE_info->Msg4_ACKed[UE_id] = true;
|
||||
else UE_info->Msg4_ACKed[UE_id] = false;
|
||||
UE_info->rnti[UE_id] = rntiP;
|
||||
UE_info->CellGroup[UE_id] = CellGroup;
|
||||
add_nr_list(&UE_info->list, UE_id);
|
||||
@@ -1806,12 +1852,13 @@ void get_pdsch_to_harq_feedback(int Mod_idP,
|
||||
int bwp_id=1;
|
||||
NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info;
|
||||
NR_CellGroupConfig_t *CellGroup = UE_info->CellGroup[UE_id];
|
||||
NR_BWP_Downlink_t *bwp=CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList ?
|
||||
CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1] :
|
||||
NULL;
|
||||
NR_BWP_Uplink_t *ubwp=CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList?
|
||||
CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_id-1] :
|
||||
NULL;
|
||||
NR_BWP_Downlink_t *bwp=NULL;
|
||||
NR_BWP_Uplink_t *ubwp=NULL;
|
||||
|
||||
if (CellGroup && CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList)
|
||||
bwp = CellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.array[bwp_id-1];
|
||||
if (CellGroup && CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList)
|
||||
ubwp = CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[bwp_id-1];
|
||||
|
||||
NR_SearchSpace_t *ss;
|
||||
|
||||
|
||||
@@ -78,7 +78,8 @@ void nr_fill_nfapi_pucch(module_id_t mod_id,
|
||||
pucch->resource_indicator,
|
||||
pucch->csi_bits,
|
||||
pucch->dai_c,
|
||||
pucch->sr_flag);
|
||||
pucch->sr_flag,
|
||||
pucch->r_pucch);
|
||||
}
|
||||
|
||||
#define MIN_RSRP_VALUE -141
|
||||
@@ -1077,7 +1078,8 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id,
|
||||
bool nr_acknack_scheduling(int mod_id,
|
||||
int UE_id,
|
||||
frame_t frame,
|
||||
sub_frame_t slot)
|
||||
sub_frame_t slot,
|
||||
int r_pucch)
|
||||
{
|
||||
const NR_ServingCellConfigCommon_t *scc = RC.nrmac[mod_id]->common_channels->ServingCellConfigCommon;
|
||||
const int n_slots_frame = nr_slots_per_frame[*scc->ssbSubcarrierSpacing];
|
||||
@@ -1105,6 +1107,7 @@ bool nr_acknack_scheduling(int mod_id,
|
||||
* resources by index, and not by their ID! */
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &RC.nrmac[mod_id]->UE_info.UE_sched_ctrl[UE_id];
|
||||
NR_sched_pucch_t *pucch = &sched_ctrl->sched_pucch[0];
|
||||
pucch->r_pucch=r_pucch;
|
||||
AssertFatal(pucch->csi_bits == 0,
|
||||
"%s(): csi_bits %d in sched_pucch[0]\n",
|
||||
__func__,
|
||||
@@ -1125,8 +1128,9 @@ bool nr_acknack_scheduling(int mod_id,
|
||||
pucch->frame = s == n_slots_frame - 1 ? (f + 1) % 1024 : f;
|
||||
pucch->ul_slot = (s + 1) % n_slots_frame;
|
||||
// we assume that only two indices over the array sched_pucch exist
|
||||
const NR_sched_pucch_t *csi_pucch = &sched_ctrl->sched_pucch[2];
|
||||
NR_sched_pucch_t *csi_pucch = &sched_ctrl->sched_pucch[2];
|
||||
// skip the CSI PUCCH if it is present and if in the next frame/slot
|
||||
csi_pucch->r_pucch=-1;
|
||||
if (csi_pucch->csi_bits > 0
|
||||
&& csi_pucch->frame == pucch->frame
|
||||
&& csi_pucch->ul_slot == pucch->ul_slot) {
|
||||
@@ -1179,7 +1183,7 @@ bool nr_acknack_scheduling(int mod_id,
|
||||
memset(pucch, 0, sizeof(*pucch));
|
||||
pucch->frame = s == n_slots_frame - 1 ? (f + 1) % 1024 : f;
|
||||
pucch->ul_slot = (s + 1) % n_slots_frame;
|
||||
return nr_acknack_scheduling(mod_id, UE_id, frame, slot);
|
||||
return nr_acknack_scheduling(mod_id, UE_id, frame, slot,pucch->r_pucch);
|
||||
}
|
||||
|
||||
pucch->timing_indicator = i;
|
||||
@@ -1190,16 +1194,26 @@ bool nr_acknack_scheduling(int mod_id,
|
||||
|
||||
/* we need to find a new PUCCH occasion */
|
||||
|
||||
NR_PUCCH_Config_t *pucch_Config;
|
||||
NR_PUCCH_Config_t *pucch_Config=NULL;
|
||||
int bwp_Id=0;
|
||||
if (sched_ctrl->active_ubwp) {
|
||||
pucch_Config = sched_ctrl->active_ubwp->bwp_Dedicated->pucch_Config->choice.setup;
|
||||
bwp_Id= sched_ctrl->active_ubwp->bwp_Id;
|
||||
}
|
||||
else pucch_Config = RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup;
|
||||
DevAssert(pucch_Config->resourceToAddModList->list.count > 0);
|
||||
DevAssert(pucch_Config->resourceSetToAddModList->list.count > 0);
|
||||
const int n_res = pucch_Config->resourceSetToAddModList->list.array[0]->resourceList.list.count;
|
||||
else if (RC.nrmac[mod_id]->UE_info.CellGroup[UE_id] &&
|
||||
RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig &&
|
||||
RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated &&
|
||||
RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->uplinkConfig &&
|
||||
RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP &&
|
||||
RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup)
|
||||
pucch_Config = RC.nrmac[mod_id]->UE_info.CellGroup[UE_id]->spCellConfig->spCellConfigDedicated->uplinkConfig->initialUplinkBWP->pucch_Config->choice.setup;
|
||||
if (pucch_Config) {
|
||||
DevAssert(pucch_Config->resourceToAddModList->list.count > 0);
|
||||
DevAssert(pucch_Config->resourceSetToAddModList->list.count > 0);
|
||||
}
|
||||
int n_res = (pucch_Config) ?
|
||||
pucch_Config->resourceSetToAddModList->list.array[0]->resourceList.list.count :
|
||||
nr_get_default_pucch_res(*scc->uplinkConfigCommon->initialUplinkBWP->pucch_ConfigCommon->choice.setup->pucch_ResourceCommon);
|
||||
int *pucch_index_used = RC.nrmac[mod_id]->pucch_index_used[bwp_Id];
|
||||
|
||||
/* if time information is outdated (e.g., last PUCCH occasion in last frame),
|
||||
@@ -1258,7 +1272,7 @@ bool nr_acknack_scheduling(int mod_id,
|
||||
LOG_D(MAC,"2. DL slot %d, UL_ACK %d (index %d)\n",slot,pucch->ul_slot,i);
|
||||
|
||||
pucch->dai_c++;
|
||||
const int pucch_res = pucch_index_used[pucch->ul_slot];
|
||||
const int pucch_res = r_pucch<0 ? pucch_index_used[pucch->ul_slot] : r_pucch;
|
||||
pucch->resource_indicator = pucch_res;
|
||||
pucch_index_used[pucch->ul_slot] += 1;
|
||||
AssertFatal(pucch_index_used[pucch->ul_slot] <= n_res,
|
||||
|
||||
@@ -664,11 +664,14 @@ void pf_ul(module_id_t module_id,
|
||||
|
||||
/* Loop UE_list to calculate throughput and coeff */
|
||||
for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
|
||||
|
||||
if (UE_info->Msg4_ACKed[UE_id] != true) continue;
|
||||
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
int rbStart = NRRIV2PRBOFFSET(sched_ctrl->active_bwp ?
|
||||
int rbStart = 0; /*NRRIV2PRBOFFSET(sched_ctrl->active_bwp ?
|
||||
sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth:
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth,
|
||||
MAX_BWP_SIZE);
|
||||
MAX_BWP_SIZE);*/
|
||||
const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_ubwp?
|
||||
sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth:
|
||||
scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth,
|
||||
@@ -691,8 +694,8 @@ void pf_ul(module_id_t module_id,
|
||||
sched_ctrl->coreset = get_coreset(scc,sched_ctrl->active_bwp, sched_ctrl->search_space, 1 /* dedicated */);
|
||||
if (sched_ctrl->coreset == NULL) sched_ctrl->coreset = RC.nrmac[module_id]->sched_ctrlCommon->coreset;
|
||||
const long f = sched_ctrl->search_space->searchSpaceType->choice.ue_Specific->dci_Formats;
|
||||
const int dci_format = f ? NR_UL_DCI_FORMAT_0_1 : NR_UL_DCI_FORMAT_0_0;
|
||||
const uint8_t num_dmrs_cdm_grps_no_data = 1;
|
||||
const int dci_format = sched_ctrl->active_bwp ? (f ? NR_UL_DCI_FORMAT_0_1 : NR_UL_DCI_FORMAT_0_0) : NR_UL_DCI_FORMAT_0_0;
|
||||
const uint8_t num_dmrs_cdm_grps_no_data = sched_ctrl->active_bwp ? 1 : 2;
|
||||
NR_sched_pusch_save_t *ps = &sched_ctrl->pusch_save;
|
||||
if (ps->time_domain_allocation != tda
|
||||
|| ps->dci_format != dci_format
|
||||
@@ -728,8 +731,8 @@ void pf_ul(module_id_t module_id,
|
||||
|
||||
while (rbStart < bwpSize && !rballoc_mask[rbStart]) rbStart++;
|
||||
if (rbStart + sched_pusch->rbSize >= bwpSize) {
|
||||
LOG_W(MAC, "cannot allocate UL data for UE %d/RNTI %04x: no resources\n",
|
||||
UE_id, UE_info->rnti[UE_id]);
|
||||
LOG_W(MAC, "cannot allocate UL data for UE %d/RNTI %04x: no resources (rbStart %d, sched_pusch->rbSize %d, bwpSize %d)\n",
|
||||
UE_id, UE_info->rnti[UE_id],rbStart,sched_pusch->rbSize,bwpSize);
|
||||
return;
|
||||
}
|
||||
sched_pusch->rbStart = rbStart;
|
||||
@@ -763,7 +766,7 @@ void pf_ul(module_id_t module_id,
|
||||
/* if no data, pre-allocate 5RB */
|
||||
bool freeCCE = find_free_CCE(module_id, slot, UE_id);
|
||||
if (!freeCCE) {
|
||||
LOG_D(MAC, "%4d.%2d no free CCE for UL DCI UE %04x (BSR 0)\n", frame, slot, UE_info->rnti[UE_id]);
|
||||
LOG_I(MAC, "%4d.%2d no free CCE for UL DCI UE %04x (BSR 0)\n", frame, slot, UE_info->rnti[UE_id]);
|
||||
continue;
|
||||
}
|
||||
/* reduce max_num_ue once we are sure UE can be allocated, i.e., has CCE */
|
||||
@@ -773,8 +776,8 @@ void pf_ul(module_id_t module_id,
|
||||
|
||||
while (rbStart < bwpSize && !rballoc_mask[rbStart]) rbStart++;
|
||||
if (rbStart + min_rb >= bwpSize) {
|
||||
LOG_W(MAC, "cannot allocate UL data for UE %d/RNTI %04x: no resources\n",
|
||||
UE_id, UE_info->rnti[UE_id]);
|
||||
LOG_W(MAC, "cannot allocate UL data for UE %d/RNTI %04x: no resources (rbStart %d, min_rb %d, bwpSize %d\n",
|
||||
UE_id, UE_info->rnti[UE_id],rbStart,min_rb,bwpSize);
|
||||
return;
|
||||
}
|
||||
sched_pusch->rbStart = rbStart;
|
||||
@@ -847,16 +850,17 @@ void pf_ul(module_id_t module_id,
|
||||
return;
|
||||
|
||||
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
|
||||
int rbStart = NRRIV2PRBOFFSET(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
NR_BWP_t *genericParameters = sched_ctrl->active_ubwp ? &sched_ctrl->active_ubwp->bwp_Common->genericParameters:&scc->uplinkConfigCommon->initialUplinkBWP->genericParameters;
|
||||
int rbStart = 0; /*NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);*/
|
||||
const uint16_t bwpSize = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);
|
||||
NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch;
|
||||
|
||||
|
||||
while (rbStart < bwpSize && !rballoc_mask[rbStart]) rbStart++;
|
||||
sched_pusch->rbStart = rbStart;
|
||||
if (rbStart + min_rb >= bwpSize) {
|
||||
LOG_W(MAC, "cannot allocate UL data for UE %d/RNTI %04x: no resources\n",
|
||||
UE_id, UE_info->rnti[UE_id]);
|
||||
LOG_W(MAC, "cannot allocate UL data for UE %d/RNTI %04x: no resources (rbStart %d, min_rb %d, bwpSize %d\n",
|
||||
UE_id, UE_info->rnti[UE_id],rbStart,min_rb,bwpSize);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1009,6 +1013,7 @@ void nr_schedule_ulsch(module_id_t module_id,
|
||||
/* dynamic PUSCH values (RB alloc, MCS, hence R, Qm, TBS) that change in
|
||||
* every TTI are pre-populated by the preprocessor and used below */
|
||||
NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch;
|
||||
LOG_D(MAC,"UE %x : sched_pusch->rbSize %d\n",UE_info->rnti[UE_id],sched_pusch->rbSize);
|
||||
if (sched_pusch->rbSize <= 0)
|
||||
continue;
|
||||
|
||||
@@ -1105,9 +1110,10 @@ void nr_schedule_ulsch(module_id_t module_id,
|
||||
pusch_pdu->handle = 0; //not yet used
|
||||
|
||||
/* FAPI: BWP */
|
||||
pusch_pdu->bwp_size = NRRIV2BW(sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
pusch_pdu->bwp_start = NRRIV2PRBOFFSET(sched_ctrl->active_ubwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
|
||||
pusch_pdu->subcarrier_spacing = sched_ctrl->active_ubwp->bwp_Common->genericParameters.subcarrierSpacing;
|
||||
NR_BWP_t *genericParameters = sched_ctrl->active_ubwp ? &sched_ctrl->active_ubwp->bwp_Common->genericParameters:&scc->uplinkConfigCommon->initialUplinkBWP->genericParameters;
|
||||
pusch_pdu->bwp_size = NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);
|
||||
pusch_pdu->bwp_start = NRRIV2PRBOFFSET(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);
|
||||
pusch_pdu->subcarrier_spacing = genericParameters->subcarrierSpacing;
|
||||
pusch_pdu->cyclic_prefix = 0;
|
||||
|
||||
/* FAPI: PUSCH information always included */
|
||||
@@ -1116,7 +1122,8 @@ void nr_schedule_ulsch(module_id_t module_id,
|
||||
pusch_pdu->mcs_index = sched_pusch->mcs;
|
||||
pusch_pdu->mcs_table = ps->mcs_table;
|
||||
pusch_pdu->transform_precoding = ps->transform_precoding;
|
||||
if (ps->pusch_Config->dataScramblingIdentityPUSCH)
|
||||
if (ps->pusch_Config &&
|
||||
ps->pusch_Config->dataScramblingIdentityPUSCH)
|
||||
pusch_pdu->data_scrambling_id = *ps->pusch_Config->dataScramblingIdentityPUSCH;
|
||||
else
|
||||
pusch_pdu->data_scrambling_id = *scc->physCellId;
|
||||
@@ -1126,10 +1133,10 @@ void nr_schedule_ulsch(module_id_t module_id,
|
||||
pusch_pdu->ul_dmrs_symb_pos = ps->ul_dmrs_symb_pos;
|
||||
pusch_pdu->dmrs_config_type = ps->dmrs_config_type;
|
||||
if (pusch_pdu->transform_precoding) { // transform precoding disabled
|
||||
long *scramblingid;
|
||||
if (pusch_pdu->scid == 0)
|
||||
long *scramblingid=NULL;
|
||||
if (ps->NR_DMRS_UplinkConfig && pusch_pdu->scid == 0)
|
||||
scramblingid = ps->NR_DMRS_UplinkConfig->transformPrecodingDisabled->scramblingID0;
|
||||
else
|
||||
else if (ps->NR_DMRS_UplinkConfig)
|
||||
scramblingid = ps->NR_DMRS_UplinkConfig->transformPrecodingDisabled->scramblingID1;
|
||||
if (scramblingid == NULL)
|
||||
pusch_pdu->ul_dmrs_scrambling_id = *scc->physCellId;
|
||||
@@ -1138,9 +1145,9 @@ void nr_schedule_ulsch(module_id_t module_id,
|
||||
}
|
||||
else {
|
||||
pusch_pdu->ul_dmrs_scrambling_id = *scc->physCellId;
|
||||
if (ps->NR_DMRS_UplinkConfig->transformPrecodingEnabled->nPUSCH_Identity != NULL)
|
||||
if (ps->NR_DMRS_UplinkConfig && ps->NR_DMRS_UplinkConfig->transformPrecodingEnabled->nPUSCH_Identity != NULL)
|
||||
pusch_pdu->pusch_identity = *ps->NR_DMRS_UplinkConfig->transformPrecodingEnabled->nPUSCH_Identity;
|
||||
else
|
||||
else if (ps->NR_DMRS_UplinkConfig)
|
||||
pusch_pdu->pusch_identity = *scc->physCellId;
|
||||
}
|
||||
pusch_pdu->scid = 0; // DMRS sequence initialization [TS38.211, sec 6.4.1.1.1]
|
||||
@@ -1148,13 +1155,11 @@ void nr_schedule_ulsch(module_id_t module_id,
|
||||
pusch_pdu->dmrs_ports = 1;
|
||||
|
||||
/* FAPI: Pusch Allocation in frequency domain */
|
||||
AssertFatal(ps->pusch_Config->resourceAllocation == NR_PUSCH_Config__resourceAllocation_resourceAllocationType1,
|
||||
"Only frequency resource allocation type 1 is currently supported\n");
|
||||
pusch_pdu->resource_alloc = 1; //type 1
|
||||
pusch_pdu->rb_start = sched_pusch->rbStart;
|
||||
pusch_pdu->rb_size = sched_pusch->rbSize;
|
||||
pusch_pdu->vrb_to_prb_mapping = 0;
|
||||
if (ps->pusch_Config->frequencyHopping==NULL)
|
||||
if (ps->pusch_Config==NULL || ps->pusch_Config->frequencyHopping==NULL)
|
||||
pusch_pdu->frequency_hopping = 0;
|
||||
else
|
||||
pusch_pdu->frequency_hopping = 1;
|
||||
@@ -1178,8 +1183,8 @@ void nr_schedule_ulsch(module_id_t module_id,
|
||||
pusch_pdu->dfts_ofdm.low_papr_group_number = pusch_pdu->pusch_identity % 30;
|
||||
|
||||
// V as specified in section 6.4.1.1.1.2 in 38.211 V = 0 if sequence hopping and group hopping are disabled
|
||||
if ((ps->NR_DMRS_UplinkConfig->transformPrecodingEnabled->sequenceGroupHopping == NULL) &&
|
||||
(ps->NR_DMRS_UplinkConfig->transformPrecodingEnabled->sequenceHopping == NULL))
|
||||
if ((ps->NR_DMRS_UplinkConfig==NULL) || ((ps->NR_DMRS_UplinkConfig->transformPrecodingEnabled->sequenceGroupHopping == NULL) &&
|
||||
(ps->NR_DMRS_UplinkConfig->transformPrecodingEnabled->sequenceHopping == NULL)))
|
||||
pusch_pdu->dfts_ofdm.low_papr_sequence_number = 0;
|
||||
else
|
||||
AssertFatal(1==0,"SequenceGroupHopping or sequenceHopping are NOT Supported\n");
|
||||
@@ -1190,7 +1195,7 @@ void nr_schedule_ulsch(module_id_t module_id,
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
|
||||
/* PUSCH PTRS */
|
||||
if (ps->NR_DMRS_UplinkConfig->phaseTrackingRS != NULL) {
|
||||
if (ps->NR_DMRS_UplinkConfig && ps->NR_DMRS_UplinkConfig->phaseTrackingRS != NULL) {
|
||||
bool valid_ptrs_setup = false;
|
||||
pusch_pdu->pusch_ptrs.ptrs_ports_list = (nfapi_nr_ptrs_ports_t *) malloc(2*sizeof(nfapi_nr_ptrs_ports_t));
|
||||
valid_ptrs_setup = set_ul_ptrs_values(ps->NR_DMRS_UplinkConfig->phaseTrackingRS->choice.setup,
|
||||
@@ -1208,8 +1213,10 @@ void nr_schedule_ulsch(module_id_t module_id,
|
||||
|
||||
/* look up the PDCCH PDU for this BWP and CORESET. If it does not exist,
|
||||
* create it */
|
||||
const int bwpid = sched_ctrl->active_bwp->bwp_Id;
|
||||
const int coresetid = sched_ctrl->coreset->controlResourceSetId;
|
||||
const int bwpid = sched_ctrl->active_bwp ? sched_ctrl->active_bwp->bwp_Id : 0;
|
||||
NR_SearchSpace_t *ss = sched_ctrl->active_bwp ? sched_ctrl->search_space: RC.nrmac[module_id]->sched_ctrlCommon->search_space;
|
||||
NR_ControlResourceSet_t *coreset = sched_ctrl->active_bwp? sched_ctrl->coreset: RC.nrmac[module_id]->sched_ctrlCommon->coreset;
|
||||
const int coresetid = coreset->controlResourceSetId;
|
||||
nfapi_nr_dl_tti_pdcch_pdu_rel15_t *pdcch_pdu = pdcch_pdu_bwp_coreset[bwpid][coresetid];
|
||||
if (!pdcch_pdu) {
|
||||
nfapi_nr_ul_dci_request_pdus_t *ul_dci_request_pdu = &ul_dci_req->ul_dci_pdu_list[ul_dci_req->numPdus];
|
||||
@@ -1218,7 +1225,7 @@ void nr_schedule_ulsch(module_id_t module_id,
|
||||
ul_dci_request_pdu->PDUSize = (uint8_t)(2+sizeof(nfapi_nr_dl_tti_pdcch_pdu));
|
||||
pdcch_pdu = &ul_dci_request_pdu->pdcch_pdu.pdcch_pdu_rel15;
|
||||
ul_dci_req->numPdus += 1;
|
||||
nr_configure_pdcch(pdcch_pdu, sched_ctrl->search_space, sched_ctrl->coreset, scc, sched_ctrl->active_bwp);
|
||||
nr_configure_pdcch(pdcch_pdu, ss, coreset, scc, sched_ctrl->active_bwp);
|
||||
pdcch_pdu_bwp_coreset[bwpid][coresetid] = pdcch_pdu;
|
||||
}
|
||||
|
||||
@@ -1228,9 +1235,9 @@ void nr_schedule_ulsch(module_id_t module_id,
|
||||
nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu->dci_pdu[pdcch_pdu->numDlDci];
|
||||
pdcch_pdu->numDlDci++;
|
||||
dci_pdu->RNTI = rnti;
|
||||
if (sched_ctrl->coreset->pdcch_DMRS_ScramblingID &&
|
||||
sched_ctrl->search_space->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_ue_Specific) {
|
||||
dci_pdu->ScramblingId = *sched_ctrl->coreset->pdcch_DMRS_ScramblingID;
|
||||
if (coreset->pdcch_DMRS_ScramblingID &&
|
||||
ss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_ue_Specific) {
|
||||
dci_pdu->ScramblingId = *coreset->pdcch_DMRS_ScramblingID;
|
||||
dci_pdu->ScramblingRNTI = rnti;
|
||||
} else {
|
||||
dci_pdu->ScramblingId = *scc->physCellId;
|
||||
@@ -1249,15 +1256,16 @@ void nr_schedule_ulsch(module_id_t module_id,
|
||||
CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig &&
|
||||
CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList)
|
||||
n_ubwp = CellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.count;
|
||||
else n_ubwp=1;
|
||||
|
||||
config_uldci(sched_ctrl->active_ubwp,
|
||||
scc,
|
||||
pusch_pdu,
|
||||
&uldci_payload,
|
||||
ps->dci_format,
|
||||
ps->time_domain_allocation,
|
||||
UE_info->UE_sched_ctrl[UE_id].tpc0,
|
||||
n_ubwp,
|
||||
sched_ctrl->active_bwp->bwp_Id);
|
||||
bwpid);
|
||||
fill_dci_pdu_rel15(scc,
|
||||
CellGroup,
|
||||
dci_pdu,
|
||||
@@ -1265,7 +1273,7 @@ void nr_schedule_ulsch(module_id_t module_id,
|
||||
ps->dci_format,
|
||||
rnti_types[0],
|
||||
pusch_pdu->bwp_size,
|
||||
sched_ctrl->active_bwp->bwp_Id);
|
||||
bwpid);
|
||||
|
||||
memset(sched_pusch, 0, sizeof(*sched_pusch));
|
||||
}
|
||||
|
||||
@@ -178,6 +178,7 @@ void handle_nr_uci_pucch_2_3_4(module_id_t mod_id,
|
||||
|
||||
|
||||
void config_uldci(const NR_BWP_Uplink_t *ubwp,
|
||||
const NR_ServingCellConfigCommon_t *scc,
|
||||
const nfapi_nr_pusch_pdu_t *pusch_pdu,
|
||||
dci_pdu_rel15_t *dci_pdu_rel15,
|
||||
int dci_format,
|
||||
@@ -200,7 +201,8 @@ void nr_csi_meas_reporting(int Mod_idP,
|
||||
bool nr_acknack_scheduling(int Mod_idP,
|
||||
int UE_id,
|
||||
frame_t frameP,
|
||||
sub_frame_t slotP);
|
||||
sub_frame_t slotP,
|
||||
int r_pucch);
|
||||
|
||||
void get_pdsch_to_harq_feedback(int Mod_idP,
|
||||
int UE_id,
|
||||
@@ -234,7 +236,8 @@ void nr_configure_pucch(nfapi_nr_pucch_pdu_t* pucch_pdu,
|
||||
uint8_t pucch_resource,
|
||||
uint16_t O_csi,
|
||||
uint16_t O_ack,
|
||||
uint8_t O_sr);
|
||||
uint8_t O_sr,
|
||||
int r_pucch);
|
||||
|
||||
void find_search_space(int ss_type,
|
||||
NR_BWP_Downlink_t *bwp,
|
||||
@@ -339,6 +342,8 @@ uint16_t compute_pucch_prb_size(uint8_t format,
|
||||
uint8_t n_symb,
|
||||
uint8_t n_re_ctrl);
|
||||
|
||||
int nr_get_default_pucch_res(int pucch_ResourceCommon);
|
||||
|
||||
void compute_csi_bitlen(NR_CSI_MeasConfig_t *csi_MeasConfig, NR_UE_info_t *UE_info, int UE_id, module_id_t Mod_idP);
|
||||
|
||||
int get_dlscs(nfapi_nr_config_request_t *cfg);
|
||||
|
||||
@@ -304,6 +304,7 @@ typedef struct NR_sched_pucch {
|
||||
uint8_t dai_c;
|
||||
uint8_t timing_indicator;
|
||||
uint8_t resource_indicator;
|
||||
int r_pucch;
|
||||
} NR_sched_pucch_t;
|
||||
|
||||
/* this struct is a helper: as long as the TDA and DCI format remain the same
|
||||
@@ -585,6 +586,7 @@ typedef struct {
|
||||
int num_pdcch_cand[MAX_MOBILES_PER_GNB][MAX_NUM_CORESET];
|
||||
// UE selected beam index
|
||||
uint8_t UE_beam_index[MAX_MOBILES_PER_GNB];
|
||||
bool Msg4_ACKed[MAX_MOBILES_PER_GNB];
|
||||
} NR_UE_info_t;
|
||||
|
||||
typedef void (*nr_pp_impl_dl)(module_id_t mod_id,
|
||||
|
||||
@@ -47,7 +47,11 @@ const char *dl_indication_type[] = {"MIB", "SIB", "DLSCH", "DCI", "RAR"};
|
||||
static nr_ue_if_module_t *nr_ue_if_module_inst[MAX_IF_MODULES];
|
||||
|
||||
// L2 Abstraction Layer
|
||||
int handle_bcch_bch(module_id_t module_id, int cc_id, unsigned int gNB_index, uint8_t *pduP, unsigned int additional_bits, uint32_t ssb_index, uint32_t ssb_length, uint16_t cell_id){
|
||||
int handle_bcch_bch(module_id_t module_id, int cc_id,
|
||||
unsigned int gNB_index, uint8_t *pduP,
|
||||
unsigned int additional_bits,
|
||||
uint32_t ssb_index, uint32_t ssb_length,
|
||||
uint16_t ssb_start_subcarrier, uint16_t cell_id){
|
||||
|
||||
return nr_ue_decode_mib(module_id,
|
||||
cc_id,
|
||||
@@ -55,7 +59,8 @@ int handle_bcch_bch(module_id_t module_id, int cc_id, unsigned int gNB_index, ui
|
||||
additional_bits,
|
||||
ssb_length, // Lssb = 64 is not support
|
||||
ssb_index,
|
||||
pduP,
|
||||
pduP,
|
||||
ssb_start_subcarrier,
|
||||
cell_id);
|
||||
|
||||
}
|
||||
@@ -158,14 +163,15 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_
|
||||
|
||||
switch(dl_info->rx_ind->rx_indication_body[i].pdu_type){
|
||||
|
||||
case FAPI_NR_RX_PDU_TYPE_MIB:
|
||||
case FAPI_NR_RX_PDU_TYPE_SSB:
|
||||
|
||||
ret_mask |= (handle_bcch_bch(dl_info->module_id, dl_info->cc_id, dl_info->gNB_index,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->mib_pdu.pdu,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->mib_pdu.additional_bits,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->mib_pdu.ssb_index,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->mib_pdu.ssb_length,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->mib_pdu.cell_id)) << FAPI_NR_RX_PDU_TYPE_MIB;
|
||||
(dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.pdu,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.additional_bits,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.ssb_index,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.ssb_length,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.ssb_start_subcarrier,
|
||||
(dl_info->rx_ind->rx_indication_body+i)->ssb_pdu.cell_id)) << FAPI_NR_RX_PDU_TYPE_SSB;
|
||||
|
||||
break;
|
||||
|
||||
|
||||
@@ -221,7 +221,15 @@ int nr_ue_dcireq(nr_dcireq_t *dcireq);
|
||||
\param ssb_index SSB index within 0 - (L_ssb-1) corresponding to 38.331 ch.13 parameter i
|
||||
\param ssb_length corresponding to L1 parameter L_ssb
|
||||
\param cell_id cell id */
|
||||
int handle_bcch_bch(module_id_t module_id, int cc_id, unsigned int gNB_index, uint8_t *pduP, unsigned int additional_bits, uint32_t ssb_index, uint32_t ssb_length, uint16_t cell_id);
|
||||
int handle_bcch_bch(module_id_t module_id,
|
||||
int cc_id,
|
||||
unsigned int gNB_index,
|
||||
uint8_t *pduP,
|
||||
unsigned int additional_bits,
|
||||
uint32_t ssb_index,
|
||||
uint32_t ssb_length,
|
||||
uint16_t ssb_start_subcarrier,
|
||||
uint16_t cell_id);
|
||||
|
||||
// TODO check
|
||||
/**\brief handle BCCH-DL-SCH message from dl_indication
|
||||
|
||||
@@ -1258,11 +1258,19 @@ nr_rrc_ue_process_masterCellGroup(
|
||||
)
|
||||
//-----------------------------------------------------------------------------
|
||||
{
|
||||
NR_CellGroupConfig_t *cellGroupConfig = (NR_CellGroupConfig_t *)masterCellGroup;
|
||||
NR_CellGroupConfig_t *cellGroupConfig=NULL;
|
||||
uper_decode(NULL,
|
||||
&asn_DEF_NR_CellGroupConfig, //might be added prefix later
|
||||
(void **)&cellGroupConfig,
|
||||
(uint8_t *)masterCellGroup->buf,
|
||||
masterCellGroup->size, 0, 0);
|
||||
xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, (const void*)cellGroupConfig);
|
||||
if( cellGroupConfig->spCellConfig != NULL && cellGroupConfig->spCellConfig->reconfigurationWithSync != NULL){
|
||||
//TODO (perform Reconfiguration with sync according to 5.3.5.5.2)
|
||||
//TODO (resume all suspended radio bearers and resume SCG transmission for all radio bearers, if suspended)
|
||||
// NSA procedures
|
||||
}
|
||||
|
||||
|
||||
if( cellGroupConfig->rlc_BearerToReleaseList != NULL){
|
||||
//TODO (perform RLC bearer release as specified in 5.3.5.5.3)
|
||||
@@ -1287,6 +1295,8 @@ nr_rrc_ue_process_masterCellGroup(
|
||||
} else {
|
||||
NR_UE_rrc_inst[ctxt_pP->module_id].cell_group_config->spCellConfig = cellGroupConfig->spCellConfig;
|
||||
}
|
||||
LOG_I(RRC,"Sending CellGroupConfig to MAC\n");
|
||||
nr_rrc_mac_config_req_ue(ctxt_pP->module_id,0,0,NULL,NULL,cellGroupConfig,NULL);
|
||||
//TODO (configure the SpCell as specified in 5.3.5.5.7)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user