2019-04-26 12:27:38 -07:00
|
|
|
/*
|
|
|
|
* Copyright 2013-2019 Software Radio Systems Limited
|
2014-08-01 14:26:28 -07:00
|
|
|
*
|
2019-04-26 12:27:38 -07:00
|
|
|
* This file is part of srsLTE.
|
2014-08-01 14:26:28 -07:00
|
|
|
*
|
2015-03-18 05:31:13 -07:00
|
|
|
* srsLTE is free software: you can redistribute it and/or modify
|
2015-05-08 08:05:40 -07:00
|
|
|
* it under the terms of the GNU Affero General Public License as
|
2014-08-01 14:26:28 -07:00
|
|
|
* published by the Free Software Foundation, either version 3 of
|
|
|
|
* the License, or (at your option) any later version.
|
|
|
|
*
|
2015-03-18 05:31:13 -07:00
|
|
|
* srsLTE is distributed in the hope that it will be useful,
|
2014-08-01 14:26:28 -07:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2015-05-08 08:05:40 -07:00
|
|
|
* GNU Affero General Public License for more details.
|
2014-08-01 14:26:28 -07:00
|
|
|
*
|
2015-05-08 08:05:40 -07:00
|
|
|
* A copy of the GNU Affero General Public License can be found in
|
2014-08-01 14:26:28 -07:00
|
|
|
* the LICENSE file in the top-level directory of this distribution
|
|
|
|
* and at http://www.gnu.org/licenses/.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2015-04-03 05:49:12 -07:00
|
|
|
/******************************************************************************
|
|
|
|
* File: ue_mib.h
|
|
|
|
*
|
|
|
|
* Description: This object decodes the MIB from the PBCH of an LTE signal.
|
|
|
|
*
|
|
|
|
* The function srslte_ue_mib_decode() shall be called multiple
|
|
|
|
* times, each passing a number of samples multiple of 19200,
|
|
|
|
* sampled at 1.92 MHz (that is, 10 ms of samples).
|
|
|
|
*
|
|
|
|
* The function uses the sync_t object to find the PSS sequence and
|
|
|
|
* decode the PBCH to obtain the MIB.
|
2015-04-08 11:47:52 -07:00
|
|
|
*
|
2015-04-03 05:49:12 -07:00
|
|
|
* The function returns 0 until the MIB is decoded.
|
|
|
|
*
|
|
|
|
* See ue_cell_detect.c for an example.
|
|
|
|
*
|
|
|
|
* Reference:
|
|
|
|
*****************************************************************************/
|
|
|
|
|
2018-03-31 10:04:04 -07:00
|
|
|
#ifndef SRSLTE_UE_MIB_H
|
|
|
|
#define SRSLTE_UE_MIB_H
|
2014-08-01 14:26:28 -07:00
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
2015-03-18 05:16:28 -07:00
|
|
|
#include "srslte/config.h"
|
2017-05-18 00:48:24 -07:00
|
|
|
#include "srslte/phy/ue/ue_sync.h"
|
|
|
|
#include "srslte/phy/sync/cfo.h"
|
|
|
|
#include "srslte/phy/ch_estimation/chest_dl.h"
|
|
|
|
#include "srslte/phy/phch/pbch.h"
|
|
|
|
#include "srslte/phy/dft/ofdm.h"
|
2014-08-01 14:26:28 -07:00
|
|
|
|
|
|
|
|
2015-03-18 11:14:24 -07:00
|
|
|
#define SRSLTE_UE_MIB_NOF_PRB 6
|
2014-08-01 14:26:28 -07:00
|
|
|
|
2015-03-18 11:14:24 -07:00
|
|
|
#define SRSLTE_UE_MIB_FOUND 1
|
|
|
|
#define SRSLTE_UE_MIB_NOTFOUND 0
|
2014-08-01 14:26:28 -07:00
|
|
|
|
2015-03-18 05:31:13 -07:00
|
|
|
typedef struct SRSLTE_API {
|
2015-03-18 11:14:24 -07:00
|
|
|
srslte_sync_t sfind;
|
2019-04-23 01:53:11 -07:00
|
|
|
|
|
|
|
cf_t* sf_symbols[SRSLTE_MAX_PORTS];
|
|
|
|
|
2015-03-18 11:14:24 -07:00
|
|
|
srslte_ofdm_t fft;
|
|
|
|
srslte_pbch_t pbch;
|
2019-04-23 01:53:11 -07:00
|
|
|
|
|
|
|
srslte_chest_dl_t chest;
|
|
|
|
srslte_chest_dl_res_t chest_res;
|
|
|
|
|
|
|
|
uint8_t bch_payload[SRSLTE_BCH_PAYLOAD_LEN];
|
2014-10-21 11:03:05 -07:00
|
|
|
uint32_t nof_tx_ports;
|
|
|
|
uint32_t sfn_offset;
|
2014-08-01 14:26:28 -07:00
|
|
|
|
|
|
|
uint32_t frame_cnt;
|
2015-03-18 11:14:24 -07:00
|
|
|
} srslte_ue_mib_t;
|
2014-08-01 14:26:28 -07:00
|
|
|
|
2015-03-18 11:14:24 -07:00
|
|
|
SRSLTE_API int srslte_ue_mib_init(srslte_ue_mib_t *q,
|
2017-10-20 07:09:27 -07:00
|
|
|
cf_t *in_buffer[SRSLTE_MAX_PORTS],
|
2017-09-01 04:29:11 -07:00
|
|
|
uint32_t max_prb);
|
2014-10-24 03:06:04 -07:00
|
|
|
|
2015-03-18 11:14:24 -07:00
|
|
|
SRSLTE_API void srslte_ue_mib_free(srslte_ue_mib_t *q);
|
2014-08-01 14:26:28 -07:00
|
|
|
|
2017-09-01 04:29:11 -07:00
|
|
|
SRSLTE_API int srslte_ue_mib_set_cell(srslte_ue_mib_t * q,
|
|
|
|
srslte_cell_t cell);
|
|
|
|
|
2015-03-18 11:14:24 -07:00
|
|
|
SRSLTE_API void srslte_ue_mib_reset(srslte_ue_mib_t * q);
|
2014-08-01 14:26:28 -07:00
|
|
|
|
2015-03-18 11:14:24 -07:00
|
|
|
SRSLTE_API int srslte_ue_mib_decode(srslte_ue_mib_t * q,
|
2015-04-08 11:47:52 -07:00
|
|
|
uint8_t bch_payload[SRSLTE_BCH_PAYLOAD_LEN],
|
2015-03-18 11:14:24 -07:00
|
|
|
uint32_t *nof_tx_ports,
|
2016-03-08 02:19:09 -08:00
|
|
|
int *sfn_offset);
|
2014-10-24 03:06:04 -07:00
|
|
|
|
2014-10-21 11:03:05 -07:00
|
|
|
|
2014-12-11 15:04:21 -08:00
|
|
|
/* This interface uses ue_mib and ue_sync to first get synchronized subframes
|
|
|
|
* and then decode MIB
|
2015-04-08 11:47:52 -07:00
|
|
|
*
|
|
|
|
* This object calls the pbch object with nof_ports=0 for blind nof_ports determination
|
2014-12-11 15:04:21 -08:00
|
|
|
*/
|
|
|
|
typedef struct {
|
2015-03-18 11:14:24 -07:00
|
|
|
srslte_ue_mib_t ue_mib;
|
|
|
|
srslte_ue_sync_t ue_sync;
|
2017-02-17 00:58:37 -08:00
|
|
|
cf_t *sf_buffer[SRSLTE_MAX_PORTS];
|
2017-02-13 04:29:20 -08:00
|
|
|
uint32_t nof_rx_antennas;
|
2015-03-18 11:14:24 -07:00
|
|
|
} srslte_ue_mib_sync_t;
|
2014-08-01 14:26:28 -07:00
|
|
|
|
2017-09-01 04:29:11 -07:00
|
|
|
SRSLTE_API int srslte_ue_mib_sync_init_multi(srslte_ue_mib_sync_t *q,
|
|
|
|
int (recv_callback)(void*, cf_t*[SRSLTE_MAX_PORTS], uint32_t, srslte_timestamp_t *),
|
2017-02-17 02:54:34 -08:00
|
|
|
uint32_t nof_rx_antennas,
|
|
|
|
void *stream_handler);
|
|
|
|
|
2015-03-18 11:14:24 -07:00
|
|
|
SRSLTE_API void srslte_ue_mib_sync_free(srslte_ue_mib_sync_t *q);
|
2014-08-01 14:26:28 -07:00
|
|
|
|
2019-04-23 01:53:11 -07:00
|
|
|
SRSLTE_API int srslte_ue_mib_sync_set_cell(srslte_ue_mib_sync_t* q, srslte_cell_t cell);
|
2017-09-01 04:29:11 -07:00
|
|
|
|
2015-03-18 11:14:24 -07:00
|
|
|
SRSLTE_API void srslte_ue_mib_sync_reset(srslte_ue_mib_sync_t * q);
|
2014-08-01 14:26:28 -07:00
|
|
|
|
2015-03-18 11:14:24 -07:00
|
|
|
SRSLTE_API int srslte_ue_mib_sync_decode(srslte_ue_mib_sync_t * q,
|
|
|
|
uint32_t max_frames_timeout,
|
2015-04-08 11:47:52 -07:00
|
|
|
uint8_t bch_payload[SRSLTE_BCH_PAYLOAD_LEN],
|
2015-03-18 11:14:24 -07:00
|
|
|
uint32_t *nof_tx_ports,
|
2016-03-08 02:19:09 -08:00
|
|
|
int *sfn_offset);
|
2014-08-01 14:26:28 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-03-31 10:04:04 -07:00
|
|
|
#endif // SRSLTE_UE_MIB_H
|
2014-08-01 14:26:28 -07:00
|
|
|
|