srsLTE/lib/include/srslte/phy/ue/ue_cell_search.h

115 lines
3.8 KiB
C
Raw Normal View History

/**
*
* \section COPYRIGHT
*
2015-11-13 04:22:33 -08:00
* Copyright 2013-2015 Software Radio Systems Limited
*
* \section LICENSE
*
* This file is part of the srsLTE library.
*
* 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
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsLTE is distributed in the hope that it will be useful,
* 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.
*
2015-05-08 08:05:40 -07:00
* A copy of the GNU Affero General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
/******************************************************************************
* File: ue_cell_search.h
*
* Description: Wrapper for the ue_sync object.
*
* This object is a wrapper to the ue_sync object. It receives
* several synchronized frames and obtains the most common cell_id
* and cp length.
*
* The I/O stream device sampling frequency must be set to 1.92 MHz
* (SRSLTE_CS_SAMP_FREQ constant) before calling to
* srslte_ue_cellsearch_scan() functions.
*
* Reference:
*****************************************************************************/
#ifndef UE_CELLSEARCH_
#define UE_CELLSEARCH_
#include <stdbool.h>
#include "srslte/config.h"
2017-05-18 00:48:24 -07:00
#include "srslte/phy/ue/ue_sync.h"
#include "srslte/phy/ue/ue_mib.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"
2015-03-18 11:14:24 -07:00
#define SRSLTE_CS_NOF_PRB 6
#define SRSLTE_CS_SAMP_FREQ 1920000.0
typedef struct SRSLTE_API {
uint32_t cell_id;
2015-03-18 05:41:50 -07:00
srslte_cp_t cp;
float peak;
float mode;
float psr;
float cfo;
2015-03-18 11:14:24 -07:00
} srslte_ue_cellsearch_result_t;
typedef struct SRSLTE_API {
2015-03-18 11:14:24 -07:00
srslte_ue_sync_t ue_sync;
cf_t *sf_buffer[SRSLTE_MAX_PORTS];
2017-02-13 04:29:20 -08:00
uint32_t nof_rx_antennas;
uint32_t max_frames;
uint32_t nof_valid_frames; // number of 5 ms frames to scan
uint32_t *mode_ntimes;
uint8_t *mode_counted;
2015-03-18 11:14:24 -07:00
srslte_ue_cellsearch_result_t *candidates;
} srslte_ue_cellsearch_t;
2015-03-18 11:14:24 -07:00
SRSLTE_API int srslte_ue_cellsearch_init(srslte_ue_cellsearch_t *q,
uint32_t max_frames_total,
2017-02-17 02:54:34 -08:00
int (recv_callback)(void*, void*, uint32_t,srslte_timestamp_t*),
2015-03-18 11:14:24 -07:00
void *stream_handler);
2017-02-17 02:54:34 -08:00
SRSLTE_API int srslte_ue_cellsearch_init_multi(srslte_ue_cellsearch_t *q,
uint32_t max_frames_total,
int (recv_callback)(void*, cf_t*[SRSLTE_MAX_PORTS], uint32_t,srslte_timestamp_t*),
uint32_t nof_rx_antennas,
void *stream_handler);
2015-03-18 11:14:24 -07:00
SRSLTE_API void srslte_ue_cellsearch_free(srslte_ue_cellsearch_t *q);
2015-03-18 11:14:24 -07:00
SRSLTE_API int srslte_ue_cellsearch_scan_N_id_2(srslte_ue_cellsearch_t *q,
uint32_t N_id_2,
srslte_ue_cellsearch_result_t *found_cell);
2015-03-18 11:14:24 -07:00
SRSLTE_API int srslte_ue_cellsearch_scan(srslte_ue_cellsearch_t * q,
srslte_ue_cellsearch_result_t found_cells[3],
uint32_t *max_N_id_2);
SRSLTE_API int srslte_ue_cellsearch_set_nof_valid_frames(srslte_ue_cellsearch_t *q,
uint32_t nof_frames);
#endif // SYNC_FRAME_