mirror of https://github.com/PentHertz/srsLTE.git
Simplified ue_mib API
This commit is contained in:
parent
bb98b588bd
commit
b2c009e1fa
|
@ -75,7 +75,7 @@ int decode_pbch(void *uhd, ue_celldetect_result_t *found_cell, uint32_t nof_fram
|
|||
|
||||
DEBUG("Calling ue_mib_decode() %d/%d\n", nof_frames, nof_frames_total);
|
||||
|
||||
n = ue_mib_decode(&uemib, buffer, flen, bch_payload, nof_tx_ports, sfn_offset);
|
||||
n = ue_mib_decode(&uemib, buffer, flen);
|
||||
if (n == LIBLTE_ERROR || n == LIBLTE_ERROR_INVALID_INPUTS) {
|
||||
fprintf(stderr, "Error calling ue_mib_decode()\n");
|
||||
goto free_and_exit;
|
||||
|
@ -93,6 +93,7 @@ int decode_pbch(void *uhd, ue_celldetect_result_t *found_cell, uint32_t nof_fram
|
|||
|
||||
if (n == MIB_FOUND) {
|
||||
printf("\n\nMIB decoded in %d ms (%d half frames)\n", nof_frames*5, nof_frames);
|
||||
ue_mib_get_payload(&uemib, bch_payload, nof_tx_ports, sfn_offset);
|
||||
ret = LIBLTE_SUCCESS;
|
||||
} else {
|
||||
ret = LIBLTE_ERROR;
|
||||
|
|
|
@ -75,6 +75,10 @@ typedef struct LIBLTE_API {
|
|||
chest_t chest;
|
||||
pbch_t pbch;
|
||||
|
||||
uint8_t bch_payload[BCH_PAYLOAD_LEN];
|
||||
uint32_t nof_tx_ports;
|
||||
uint32_t sfn_offset;
|
||||
|
||||
uint32_t frame_cnt;
|
||||
uint32_t last_frame_trial;
|
||||
} ue_mib_t;
|
||||
|
@ -90,7 +94,9 @@ LIBLTE_API void ue_mib_reset(ue_mib_t *q);
|
|||
|
||||
LIBLTE_API int ue_mib_decode(ue_mib_t *q,
|
||||
cf_t *signal,
|
||||
uint32_t nsamples,
|
||||
uint32_t nsamples);
|
||||
|
||||
LIBLTE_API 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);
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in New Issue