|
|
|
@ -303,32 +303,29 @@ static int dci_blind_search(srslte_ue_dl_t *q, dci_blind_search_t *search_space,
|
|
|
|
|
if (rnti) {
|
|
|
|
|
ret = 0;
|
|
|
|
|
int i=0;
|
|
|
|
|
do {
|
|
|
|
|
printf("Searching format %s in %d,%d\n",
|
|
|
|
|
while (!ret && i < search_space->nof_locations) {
|
|
|
|
|
INFO("Searching format %s in %d,%d\n",
|
|
|
|
|
srslte_dci_format_string(search_space->format), search_space->loc[i].ncce, search_space->loc[i].L);
|
|
|
|
|
if (srslte_pdcch_decode_msg(&q->pdcch, dci_msg, &search_space->loc[i], search_space->format, &crc_rem)) {
|
|
|
|
|
fprintf(stderr, "Error decoding DCI msg\n");
|
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
|
}
|
|
|
|
|
if (crc_rem == rnti) {
|
|
|
|
|
printf("Found crc_rem=0x%x, format=%d\n", rnti, dci_msg->format);
|
|
|
|
|
// If searching for Format1A but found Format0 save it for later
|
|
|
|
|
if (dci_msg->format == SRSLTE_DCI_FORMAT0 && search_space->format == SRSLTE_DCI_FORMAT1A)
|
|
|
|
|
{
|
|
|
|
|
q->pending_ul_dci_rnti = crc_rem;
|
|
|
|
|
memcpy(&q->pending_ul_dci_msg, dci_msg, sizeof(srslte_dci_msg_t));
|
|
|
|
|
printf("Saved UL for later\n");
|
|
|
|
|
// Else if we found it, save location and leave
|
|
|
|
|
} else if (dci_msg->format == search_space->format)
|
|
|
|
|
{
|
|
|
|
|
} else if (dci_msg->format == search_space->format) {
|
|
|
|
|
ret = 1;
|
|
|
|
|
memcpy(&q->last_location, &search_space->loc[i], sizeof(srslte_dci_location_t));
|
|
|
|
|
} else {
|
|
|
|
|
printf("msg_format=%d, search_format=%d\n", dci_msg->format, search_space->format);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
i++;
|
|
|
|
|
} while (!ret && i < search_space->nof_locations);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
fprintf(stderr, "RNTI not specified\n");
|
|
|
|
|
}
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
@ -347,7 +344,7 @@ int srslte_ue_dl_find_ul_dci(srslte_ue_dl_t *q, uint32_t cfi, uint32_t sf_idx, u
|
|
|
|
|
dci_blind_search_t search_space;
|
|
|
|
|
search_space.format = SRSLTE_DCI_FORMAT0;
|
|
|
|
|
search_space.nof_locations = srslte_pdcch_ue_locations(&q->pdcch, search_space.loc, MAX_CANDIDATES_UE, sf_idx, cfi, rnti);
|
|
|
|
|
printf("Searching UL C-RNTI in %d ue locations\n", search_space.nof_locations);
|
|
|
|
|
INFO("Searching UL C-RNTI in %d ue locations\n", search_space.nof_locations);
|
|
|
|
|
return dci_blind_search(q, &search_space, rnti, dci_msg);
|
|
|
|
|
} else {
|
|
|
|
|
return 0;
|
|
|
|
@ -375,36 +372,45 @@ static int find_dl_dci_type_siprarnti(srslte_ue_dl_t *q, uint32_t cfi, uint16_t
|
|
|
|
|
int ret = 0;
|
|
|
|
|
// Configure and run DCI blind search
|
|
|
|
|
dci_blind_search_t search_space;
|
|
|
|
|
search_space.nof_locations = srslte_pdcch_common_locations(&q->pdcch, search_space.loc, MAX_CANDIDATES_COM, q->cfi);
|
|
|
|
|
printf("Searching SI/P/RA-RNTI in %d common locations, %d formats\n", search_space.nof_locations, nof_common_formats);
|
|
|
|
|
for (int f=0;f<nof_common_formats;f++) {
|
|
|
|
|
search_space.format = common_formats[f];
|
|
|
|
|
if ((ret = dci_blind_search(q, &search_space, rnti, dci_msg))) {
|
|
|
|
|
return ret;
|
|
|
|
|
search_space.nof_locations = srslte_pdcch_common_locations(&q->pdcch, search_space.loc, MAX_CANDIDATES_COM, cfi);
|
|
|
|
|
INFO("Searching SI/P/RA-RNTI in %d common locations, %d formats\n", search_space.nof_locations, nof_common_formats);
|
|
|
|
|
// Search for RNTI only if there is room for the common search space
|
|
|
|
|
if (search_space.nof_locations > 0) {
|
|
|
|
|
for (int f=0;f<nof_common_formats;f++) {
|
|
|
|
|
search_space.format = common_formats[f];
|
|
|
|
|
if ((ret = dci_blind_search(q, &search_space, rnti, dci_msg))) {
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Blind search for C-RNTI
|
|
|
|
|
static int find_dl_dci_type_crnti(srslte_ue_dl_t *q, uint32_t cfi, uint32_t sf_idx, uint16_t rnti, srslte_dci_msg_t *dci_msg)
|
|
|
|
|
{
|
|
|
|
|
int ret = 0;
|
|
|
|
|
int ret = SRSLTE_SUCCESS;
|
|
|
|
|
|
|
|
|
|
// Search UE-specific search space
|
|
|
|
|
dci_blind_search_t search_space;
|
|
|
|
|
search_space.nof_locations = srslte_pdcch_ue_locations(&q->pdcch, search_space.loc, MAX_CANDIDATES_UE, sf_idx, q->cfi, rnti);
|
|
|
|
|
printf("Searching DL C-RNTI in %d ue locations, %d formats\n", search_space.nof_locations, nof_ue_formats);
|
|
|
|
|
search_space.nof_locations = srslte_pdcch_ue_locations(&q->pdcch, search_space.loc, MAX_CANDIDATES_UE, sf_idx, cfi, rnti);
|
|
|
|
|
INFO("Searching DL C-RNTI in %d ue locations, %d formats\n", search_space.nof_locations, nof_ue_formats);
|
|
|
|
|
for (int f=0;f<nof_ue_formats;f++) {
|
|
|
|
|
search_space.format = ue_formats[f];
|
|
|
|
|
if ((ret = dci_blind_search(q, &search_space, rnti, dci_msg))) {
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// Search Common search space for Format 1A
|
|
|
|
|
|
|
|
|
|
// Search Format 1A in the Common SS also
|
|
|
|
|
search_space.format = SRSLTE_DCI_FORMAT1A;
|
|
|
|
|
search_space.nof_locations = srslte_pdcch_common_locations(&q->pdcch, search_space.loc, MAX_CANDIDATES_COM, q->cfi);
|
|
|
|
|
printf("Searching DL C-RNTI in %d ue locations, format 1A\n", search_space.nof_locations, nof_ue_formats);
|
|
|
|
|
return dci_blind_search(q, &search_space, rnti, dci_msg);
|
|
|
|
|
search_space.nof_locations = srslte_pdcch_common_locations(&q->pdcch, search_space.loc, MAX_CANDIDATES_COM, cfi);
|
|
|
|
|
// Search for RNTI only if there is room for the common search space
|
|
|
|
|
if (search_space.nof_locations > 0) {
|
|
|
|
|
INFO("Searching DL C-RNTI in %d ue locations, format 1A\n", search_space.nof_locations, nof_ue_formats);
|
|
|
|
|
return dci_blind_search(q, &search_space, rnti, dci_msg);
|
|
|
|
|
}
|
|
|
|
|
return SRSLTE_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int srslte_ue_dl_find_dl_dci_type(srslte_ue_dl_t *q, uint32_t cfi, uint32_t sf_idx,
|
|
|
|
@ -424,17 +430,19 @@ int srslte_ue_dl_decode_rnti_rv(srslte_ue_dl_t *q, cf_t *input, uint8_t *data, u
|
|
|
|
|
srslte_ra_dl_dci_t dci_unpacked;
|
|
|
|
|
srslte_ra_dl_grant_t grant;
|
|
|
|
|
int ret = SRSLTE_ERROR;
|
|
|
|
|
uint32_t cfi;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ((ret = srslte_ue_dl_decode_fft_estimate(q, input, sf_idx, &q->cfi)) < 0) {
|
|
|
|
|
if ((ret = srslte_ue_dl_decode_fft_estimate(q, input, sf_idx, &cfi)) < 0) {
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (srslte_pdcch_extract_llr(&q->pdcch, q->sf_symbols, q->ce, srslte_chest_dl_get_noise_estimate(&q->chest), sf_idx, q->cfi)) {
|
|
|
|
|
if (srslte_pdcch_extract_llr(&q->pdcch, q->sf_symbols, q->ce, srslte_chest_dl_get_noise_estimate(&q->chest), sf_idx, cfi)) {
|
|
|
|
|
fprintf(stderr, "Error extracting LLRs\n");
|
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int found_dci = srslte_ue_dl_find_dl_dci(q, q->cfi, sf_idx, rnti, &dci_msg);
|
|
|
|
|
int found_dci = srslte_ue_dl_find_dl_dci(q, cfi, sf_idx, rnti, &dci_msg);
|
|
|
|
|
if (found_dci == 1) {
|
|
|
|
|
|
|
|
|
|
if (srslte_dci_msg_to_dl_grant(&dci_msg, rnti, q->cell.nof_prb, q->cell.nof_ports, &dci_unpacked, &grant)) {
|
|
|
|
@ -442,7 +450,7 @@ int srslte_ue_dl_decode_rnti_rv(srslte_ue_dl_t *q, cf_t *input, uint8_t *data, u
|
|
|
|
|
return SRSLTE_ERROR;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ret = srslte_ue_dl_decode_rnti_rv_packet(q, &grant, data, q->cfi, sf_idx, rnti, rvidx);
|
|
|
|
|
ret = srslte_ue_dl_decode_rnti_rv_packet(q, &grant, data, cfi, sf_idx, rnti, rvidx);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (found_dci == 1 && ret == SRSLTE_SUCCESS) {
|
|
|
|
@ -474,7 +482,7 @@ bool srslte_ue_dl_decode_phich(srslte_ue_dl_t *q, uint32_t sf_idx, uint32_t n_pr
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void srslte_ue_dl_save_signal(srslte_ue_dl_t *q, srslte_softbuffer_rx_t *softbuffer, uint32_t tti, uint32_t rv_idx, uint16_t rnti) {
|
|
|
|
|
void srslte_ue_dl_save_signal(srslte_ue_dl_t *q, srslte_softbuffer_rx_t *softbuffer, uint32_t tti, uint32_t rv_idx, uint16_t rnti, uint32_t cfi) {
|
|
|
|
|
srslte_vec_save_file("sf_symbols", q->sf_symbols, SRSLTE_SF_LEN_RE(q->cell.nof_prb, q->cell.cp)*sizeof(cf_t));
|
|
|
|
|
printf("%d samples\n", SRSLTE_SF_LEN_RE(q->cell.nof_prb, q->cell.cp));
|
|
|
|
|
srslte_vec_save_file("ce0", q->ce[0], SRSLTE_SF_LEN_RE(q->cell.nof_prb, q->cell.cp)*sizeof(cf_t));
|
|
|
|
@ -502,7 +510,7 @@ void srslte_ue_dl_save_signal(srslte_ue_dl_t *q, srslte_softbuffer_rx_t *softbuf
|
|
|
|
|
snprintf(tmpstr,64,"rmout_%d.dat",i);
|
|
|
|
|
srslte_vec_save_file(tmpstr, softbuffer->buffer_f[i], (3*cb_len+12)*sizeof(int16_t));
|
|
|
|
|
}
|
|
|
|
|
printf("Saved files for tti=%d, sf=%d, cfi=%d, mcs=%d, rv=%d, rnti=%d\n", tti, tti%10, q->cfi,
|
|
|
|
|
printf("Saved files for tti=%d, sf=%d, cfi=%d, mcs=%d, rv=%d, rnti=%d\n", tti, tti%10, cfi,
|
|
|
|
|
q->pdsch_cfg.grant.mcs.idx, rv_idx, rnti);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|