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

264 lines
9.6 KiB
C
Raw Normal View History

2014-07-21 07:19:50 -07:00
/**
*
* \section COPYRIGHT
*
2015-11-13 04:22:33 -08:00
* Copyright 2013-2015 Software Radio Systems Limited
2014-07-21 07:19:50 -07:00
*
* \section LICENSE
*
* This file is part of the srsLTE library.
2014-07-21 07:19:50 -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-07-21 07:19:50 -07:00
* 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,
2014-07-21 07:19:50 -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-07-21 07:19:50 -07:00
*
2015-05-08 08:05:40 -07:00
* A copy of the GNU Affero General Public License can be found in
2014-07-21 07:19:50 -07:00
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
/******************************************************************************
* File: ue_dl.h
*
* Description: UE downlink object.
*
* This module is a frontend to all the downlink data and control
* channel processing modules.
*
* Reference:
*****************************************************************************/
2014-07-21 07:19:50 -07:00
#ifndef UEDL_H
#define UEDL_H
#include <stdbool.h>
2017-05-18 00:48:24 -07:00
#include "srslte/phy/ch_estimation/chest_dl.h"
#include "srslte/phy/dft/ofdm.h"
#include "srslte/phy/common/phy_common.h"
2014-07-21 07:19:50 -07:00
2017-05-18 00:48:24 -07:00
#include "srslte/phy/phch/dci.h"
#include "srslte/phy/phch/pcfich.h"
#include "srslte/phy/phch/pdcch.h"
#include "srslte/phy/phch/pdsch.h"
2017-09-21 03:48:09 -07:00
#include "srslte/phy/phch/pmch.h"
2017-05-18 00:48:24 -07:00
#include "srslte/phy/phch/pdsch_cfg.h"
#include "srslte/phy/phch/phich.h"
#include "srslte/phy/phch/ra.h"
#include "srslte/phy/phch/regs.h"
2014-07-21 07:19:50 -07:00
2017-05-18 00:48:24 -07:00
#include "srslte/phy/sync/cfo.h"
2016-03-24 04:30:56 -07:00
2017-05-18 00:48:24 -07:00
#include "srslte/phy/utils/vector.h"
#include "srslte/phy/utils/debug.h"
2014-07-21 07:19:50 -07:00
#include "srslte/config.h"
2014-07-21 07:19:50 -07:00
2016-11-08 08:01:14 -08:00
#define MAX_CANDIDATES_UE 16 // From 36.213 Table 9.1.1-1
#define MAX_CANDIDATES_COM 6 // From 36.213 Table 9.1.1-1
#define MAX_CANDIDATES (MAX_CANDIDATES_UE + MAX_CANDIDATES_COM)
typedef struct {
srslte_dci_format_t format;
srslte_dci_location_t loc[MAX_CANDIDATES];
uint32_t nof_locations;
} dci_blind_search_t;
typedef struct SRSLTE_API {
2015-03-18 11:14:24 -07:00
srslte_pcfich_t pcfich;
srslte_pdcch_t pdcch;
srslte_pdsch_t pdsch;
2017-09-21 03:48:09 -07:00
srslte_pmch_t pmch;
srslte_phich_t phich;
2015-03-18 11:14:24 -07:00
srslte_regs_t regs;
srslte_ofdm_t fft[SRSLTE_MAX_PORTS];
2017-09-21 03:48:09 -07:00
srslte_ofdm_t fft_mbsfn;
2015-03-18 05:41:50 -07:00
srslte_chest_dl_t chest;
2014-07-21 07:19:50 -07:00
2016-03-24 04:30:56 -07:00
srslte_cfo_t sfo_correct;
2017-09-21 03:48:09 -07:00
srslte_pdsch_cfg_t pdsch_cfg;
srslte_pdsch_cfg_t pmch_cfg;
2017-09-05 06:26:36 -07:00
srslte_softbuffer_rx_t *softbuffers[SRSLTE_MAX_CODEWORDS];
srslte_ra_dl_dci_t dl_dci;
2015-03-18 05:41:50 -07:00
srslte_cell_t cell;
2014-07-21 07:19:50 -07:00
2017-02-13 04:29:20 -08:00
uint32_t nof_rx_antennas;
2017-02-17 02:54:34 -08:00
cf_t *sf_symbols; // this is for backwards compatibility
cf_t *sf_symbols_m[SRSLTE_MAX_PORTS];
cf_t *ce[SRSLTE_MAX_PORTS]; // compatibility
cf_t *ce_m[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS];
2017-09-05 06:26:36 -07:00
/* RI, PMI and SINR for MIMO statistics */
float sinr[SRSLTE_MAX_LAYERS][SRSLTE_MAX_CODEBOOKS];
uint32_t pmi[SRSLTE_MAX_LAYERS];
uint32_t ri;
2017-11-21 01:14:09 -08:00
/* Power allocation parameter 3GPP 36.213 Clause 5.2 Rho_b */
float rho_b;
srslte_dci_format_t dci_format;
2014-07-21 07:19:50 -07:00
uint64_t pkt_errors;
uint64_t pkts_total;
2017-09-21 03:48:09 -07:00
uint64_t pdsch_pkt_errors;
uint64_t pdsch_pkts_total;
uint64_t pmch_pkt_errors;
uint64_t pmch_pkts_total;
2015-03-18 11:14:24 -07:00
uint64_t nof_detected;
2014-07-21 07:19:50 -07:00
2014-12-09 15:29:48 -08:00
uint16_t current_rnti;
2017-09-21 03:48:09 -07:00
uint16_t current_mbsfn_area_id;
2016-11-08 08:01:14 -08:00
dci_blind_search_t current_ss_ue[3][10];
dci_blind_search_t current_ss_common[3];
srslte_dci_location_t last_location;
2016-11-08 08:01:14 -08:00
srslte_dci_location_t last_location_ul;
srslte_dci_msg_t pending_ul_dci_msg;
uint16_t pending_ul_dci_rnti;
2016-03-24 04:30:56 -07:00
float sample_offset;
}srslte_ue_dl_t;
2014-07-21 07:19:50 -07:00
/* This function shall be called just after the initial synchronization */
2017-09-05 06:26:36 -07:00
SRSLTE_API int srslte_ue_dl_init(srslte_ue_dl_t *q,
cf_t *in_buffer[SRSLTE_MAX_PORTS],
2017-09-05 06:26:36 -07:00
uint32_t max_prb,
uint32_t nof_rx_antennas);
SRSLTE_API void srslte_ue_dl_free(srslte_ue_dl_t *q);
SRSLTE_API int srslte_ue_dl_set_cell(srslte_ue_dl_t *q,
srslte_cell_t cell);
2017-09-21 03:48:09 -07:00
int srslte_ue_dl_decode_fft_estimate(srslte_ue_dl_t *q,
cf_t *input[SRSLTE_MAX_PORTS],
uint32_t sf_idx,
uint32_t *cfi);
SRSLTE_API int srslte_ue_dl_decode_fft_estimate_mbsfn(srslte_ue_dl_t *q,
2017-09-05 06:26:36 -07:00
cf_t *input[SRSLTE_MAX_PORTS],
uint32_t sf_idx,
2017-09-21 03:48:09 -07:00
uint32_t *cfi,
srslte_sf_t sf_type);
int srslte_ue_dl_decode_estimate(srslte_ue_dl_t *q,
uint32_t sf_idx,
uint32_t *cfi);
2017-09-21 03:48:09 -07:00
SRSLTE_API int srslte_ue_dl_decode_estimate_mbsfn(srslte_ue_dl_t *q,
uint32_t sf_idx,
2017-09-21 03:48:09 -07:00
uint32_t *cfi,
srslte_sf_t sf_type);
2017-09-05 06:26:36 -07:00
SRSLTE_API int srslte_ue_dl_cfg_grant(srslte_ue_dl_t *q,
srslte_ra_dl_grant_t *grant,
uint32_t cfi,
uint32_t sf_idx,
int rvidx[SRSLTE_MAX_CODEWORDS],
srslte_mimo_type_t mimo_type);
SRSLTE_API int srslte_ue_dl_find_ul_dci(srslte_ue_dl_t *q,
uint32_t cfi,
2015-03-18 11:14:24 -07:00
uint32_t sf_idx,
2016-08-30 06:22:03 -07:00
uint16_t rnti,
srslte_dci_msg_t *dci_msg);
2015-03-24 07:58:33 -07:00
SRSLTE_API int srslte_ue_dl_find_dl_dci(srslte_ue_dl_t *q,
2017-09-05 06:26:36 -07:00
uint32_t tm,
2015-03-24 07:58:33 -07:00
uint32_t cfi,
uint32_t sf_idx,
2016-08-30 06:22:03 -07:00
uint16_t rnti,
srslte_dci_msg_t *dci_msg);
2015-03-24 07:58:33 -07:00
2015-07-19 13:52:56 -07:00
SRSLTE_API int srslte_ue_dl_find_dl_dci_type(srslte_ue_dl_t *q,
2017-09-05 06:26:36 -07:00
uint32_t tm,
2015-07-19 13:52:56 -07:00
uint32_t cfi,
uint32_t sf_idx,
uint16_t rnti,
2016-08-30 06:22:03 -07:00
srslte_rnti_type_t rnti_type,
srslte_dci_msg_t *dci_msg);
2015-07-19 13:52:56 -07:00
SRSLTE_API uint32_t srslte_ue_dl_get_ncce(srslte_ue_dl_t *q);
2016-03-24 04:30:56 -07:00
SRSLTE_API void srslte_ue_dl_set_sample_offset(srslte_ue_dl_t * q,
float sample_offset);
2017-09-05 06:26:36 -07:00
SRSLTE_API int srslte_ue_dl_decode(srslte_ue_dl_t *q,
cf_t *input[SRSLTE_MAX_PORTS],
uint8_t *data[SRSLTE_MAX_CODEWORDS],
uint32_t tm,
uint32_t tti,
bool acks[SRSLTE_MAX_CODEWORDS]);
SRSLTE_API int srslte_ue_dl_decode_rnti(srslte_ue_dl_t *q,
cf_t *input[SRSLTE_MAX_PORTS],
uint8_t *data[SRSLTE_MAX_CODEWORDS],
uint32_t tm,
2016-09-22 04:56:46 -07:00
uint32_t tti,
2017-09-05 06:26:36 -07:00
uint16_t rnti,
bool acks[SRSLTE_MAX_CODEWORDS]);
2017-09-21 03:48:09 -07:00
/* Used by example applications - full PMCH decode for a given MBSFN area ID
* srslte_ue_dl_decode_fft_estimate_multi,
* srslte_chest_dl_get_noise_estimate,
* srslte_ue_dl_cfg_grant,
* srslte_pmch_decode_multi
*/
SRSLTE_API int srslte_ue_dl_decode_mbsfn(srslte_ue_dl_t * q,
cf_t *input[SRSLTE_MAX_PORTS],
uint8_t *data,
uint32_t tti);
2017-09-05 06:26:36 -07:00
SRSLTE_API int srslte_ue_dl_ri_pmi_select(srslte_ue_dl_t *q,
uint8_t *ri,
uint8_t *pmi,
2017-09-05 06:26:36 -07:00
float *current_sinr);
2017-09-05 06:26:36 -07:00
SRSLTE_API int srslte_ue_dl_ri_select(srslte_ue_dl_t *q,
uint8_t *ri,
2017-09-05 06:26:36 -07:00
float *cn);
2017-02-17 02:54:34 -08:00
SRSLTE_API bool srslte_ue_dl_decode_phich(srslte_ue_dl_t *q,
uint32_t sf_idx,
uint32_t n_prb_lowest,
uint32_t n_dmrs);
SRSLTE_API void srslte_ue_dl_reset(srslte_ue_dl_t *q);
2015-03-18 11:14:24 -07:00
SRSLTE_API void srslte_ue_dl_set_rnti(srslte_ue_dl_t *q,
uint16_t rnti);
2014-07-21 07:19:50 -07:00
2017-09-21 03:48:09 -07:00
/* Generate signals if required, store in q->current_mbsfn_area_id */
SRSLTE_API int srslte_ue_dl_set_mbsfn_area_id(srslte_ue_dl_t *q,
uint16_t mbsfn_area_id);
SRSLTE_API void srslte_ue_dl_set_non_mbsfn_region(srslte_ue_dl_t *q,
uint8_t non_mbsfn_region_length);
2017-11-21 01:14:09 -08:00
SRSLTE_API void srslte_ue_dl_set_power_alloc(srslte_ue_dl_t *q,
float rho_a,
float rho_b);
2017-09-21 03:48:09 -07:00
2016-04-04 12:44:07 -07:00
SRSLTE_API void srslte_ue_dl_save_signal(srslte_ue_dl_t *q,
srslte_softbuffer_rx_t *softbuffer,
uint32_t tti,
2016-08-05 09:57:40 -07:00
uint32_t rv_idx,
2016-08-30 07:56:12 -07:00
uint16_t rnti,
uint32_t cfi);
2016-04-04 12:44:07 -07:00
#endif