|
|
|
@ -139,8 +139,7 @@ void ue_mib_set_threshold(ue_mib_t * q, float threshold)
|
|
|
|
|
sync_set_threshold(&q->sfind, threshold);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int mib_decoder_run(ue_mib_t * q, cf_t *input,
|
|
|
|
|
uint8_t bch_payload[BCH_PAYLOAD_LEN], uint32_t *nof_tx_ports, uint32_t *sfn_offset)
|
|
|
|
|
static int mib_decoder_run(ue_mib_t * q, cf_t *input)
|
|
|
|
|
{
|
|
|
|
|
int ret = LIBLTE_SUCCESS;
|
|
|
|
|
|
|
|
|
@ -163,7 +162,7 @@ static int mib_decoder_run(ue_mib_t * q, cf_t *input,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Decode PBCH */
|
|
|
|
|
ret = pbch_decode(&q->pbch, q->slot1_symbols, q->ce, bch_payload, nof_tx_ports, sfn_offset);
|
|
|
|
|
ret = pbch_decode(&q->pbch, q->slot1_symbols, q->ce, q->bch_payload, &q->nof_tx_ports, &q->sfn_offset);
|
|
|
|
|
if (ret < 0) {
|
|
|
|
|
fprintf(stderr, "Error decoding PBCH\n");
|
|
|
|
|
} else if (ret == 1) {
|
|
|
|
@ -179,12 +178,23 @@ static int mib_decoder_run(ue_mib_t * q, cf_t *input,
|
|
|
|
|
}
|
|
|
|
|
int counter1=0,counter2=0,counter3=0,counter4=0;
|
|
|
|
|
|
|
|
|
|
int ue_mib_decode(ue_mib_t * q,
|
|
|
|
|
cf_t *signal,
|
|
|
|
|
uint32_t nsamples,
|
|
|
|
|
void ue_mib_get_payload(ue_mib_t *q,
|
|
|
|
|
uint8_t bch_payload[BCH_PAYLOAD_LEN],
|
|
|
|
|
uint32_t *nof_tx_ports,
|
|
|
|
|
uint32_t *sfn_offset)
|
|
|
|
|
{
|
|
|
|
|
memcpy(bch_payload, q->bch_payload, sizeof(uint8_t) * BCH_PAYLOAD_LEN);
|
|
|
|
|
if (nof_tx_ports) {
|
|
|
|
|
*nof_tx_ports = q->nof_tx_ports;
|
|
|
|
|
}
|
|
|
|
|
if (sfn_offset) {
|
|
|
|
|
*sfn_offset = q->sfn_offset;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int ue_mib_decode(ue_mib_t * q,
|
|
|
|
|
cf_t *signal,
|
|
|
|
|
uint32_t nsamples)
|
|
|
|
|
{
|
|
|
|
|
int ret = LIBLTE_ERROR_INVALID_INPUTS;
|
|
|
|
|
uint32_t peak_idx=0;
|
|
|
|
@ -229,7 +239,7 @@ int ue_mib_decode(ue_mib_t * q,
|
|
|
|
|
sync_get_sf_idx(&q->sfind) == 0)
|
|
|
|
|
{
|
|
|
|
|
INFO("Trying to decode MIB\n",0);
|
|
|
|
|
ret = mib_decoder_run(q, &signal[nf*MIB_FRAME_SIZE+peak_idx], bch_payload, nof_tx_ports, sfn_offset);
|
|
|
|
|
ret = mib_decoder_run(q, &signal[nf*MIB_FRAME_SIZE+peak_idx]);
|
|
|
|
|
counter3++;
|
|
|
|
|
} else if ((ret == LIBLTE_SUCCESS && peak_idx != 0) ||
|
|
|
|
|
(ret == 1 && nf*MIB_FRAME_SIZE + peak_idx + 960 > nsamples))
|
|
|
|
|