srsLTE/lib/include/srslte/phy/phch/pdsch.h

141 lines
5.0 KiB
C
Raw Normal View History

/**
*
* \section COPYRIGHT
*
* Copyright 2013-2020 Software Radio Systems Limited
*
* By using this file, you agree to the terms and conditions set
* forth in the LICENSE file which can be found at the top level of
* the distribution.
*
*/
/******************************************************************************
* File: pdsch.h
*
* Description: Physical downlink shared channel
*
* Reference: 3GPP TS 36.211 version 10.0.0 Release 10 Sec. 6.4
*****************************************************************************/
2018-03-31 10:04:04 -07:00
#ifndef SRSLTE_PDSCH_H
#define SRSLTE_PDSCH_H
#include "srslte/config.h"
2019-04-23 01:53:11 -07:00
#include "srslte/phy/ch_estimation/chest_dl.h"
2017-05-18 00:48:24 -07:00
#include "srslte/phy/common/phy_common.h"
#include "srslte/phy/mimo/layermap.h"
2019-04-23 01:53:11 -07:00
#include "srslte/phy/mimo/precoding.h"
2017-05-18 00:48:24 -07:00
#include "srslte/phy/modem/demod_soft.h"
#include "srslte/phy/modem/evm.h"
2019-04-23 01:53:11 -07:00
#include "srslte/phy/modem/mod.h"
2017-05-18 00:48:24 -07:00
#include "srslte/phy/phch/dci.h"
2019-04-23 01:53:11 -07:00
#include "srslte/phy/phch/pdsch_cfg.h"
2017-05-18 00:48:24 -07:00
#include "srslte/phy/phch/regs.h"
#include "srslte/phy/phch/sch.h"
2019-04-23 01:53:11 -07:00
#include "srslte/phy/scrambling/scrambling.h"
typedef struct {
2019-04-23 01:53:11 -07:00
srslte_sequence_t seq[SRSLTE_MAX_CODEWORDS][SRSLTE_NOF_SF_X_FRAME];
uint32_t cell_id;
bool sequence_generated;
} srslte_pdsch_user_t;
/* PDSCH object */
typedef struct SRSLTE_API {
2015-03-18 05:41:50 -07:00
srslte_cell_t cell;
uint32_t nof_rx_antennas;
uint32_t max_re;
2017-09-07 04:19:53 -07:00
uint16_t ue_rnti;
bool is_ue;
bool llr_is_8bit;
/* buffers */
// void buffers are shared for tx and rx
cf_t* ce[SRSLTE_MAX_PORTS][SRSLTE_MAX_PORTS]; /* Channel estimation (Rx only) */
cf_t* symbols[SRSLTE_MAX_PORTS]; /* PDSCH Encoded/Decoded Symbols */
cf_t* x[SRSLTE_MAX_LAYERS]; /* Layer mapped */
cf_t* d[SRSLTE_MAX_CODEWORDS]; /* Modulated/Demodulated codewords */
void* e[SRSLTE_MAX_CODEWORDS];
float* csi[SRSLTE_MAX_CODEWORDS]; /* Channel Strengh Indicator */
/* tx & rx objects */
2020-02-27 08:00:54 -08:00
srslte_modem_table_t mod[SRSLTE_MOD_NITEMS];
// EVM buffers, one for each codeword (avoid concurrency issue with coworker)
srslte_evm_buffer_t* evm_buffer[SRSLTE_MAX_CODEWORDS];
float avg_evm;
2016-05-06 02:03:42 -07:00
// This is to generate the scrambling seq for multiple CRNTIs
srslte_pdsch_user_t** users;
srslte_sequence_t tmp_seq;
2015-03-18 11:14:24 -07:00
srslte_sch_t dl_sch;
2017-09-05 06:26:36 -07:00
void* coworker_ptr;
2018-06-06 07:59:00 -07:00
2015-03-18 11:14:24 -07:00
} srslte_pdsch_t;
2019-04-23 01:53:11 -07:00
typedef struct {
uint8_t* payload;
bool crc;
float avg_iterations_block;
float evm;
2019-04-23 01:53:11 -07:00
} srslte_pdsch_res_t;
2017-09-05 06:26:36 -07:00
SRSLTE_API int srslte_pdsch_init_ue(srslte_pdsch_t* q, uint32_t max_prb, uint32_t nof_rx_antennas);
SRSLTE_API int srslte_pdsch_init_enb(srslte_pdsch_t* q, uint32_t max_prb);
SRSLTE_API void srslte_pdsch_free(srslte_pdsch_t* q);
2019-04-23 01:53:11 -07:00
/* These functions modify the state of the object and may take some time */
SRSLTE_API int srslte_pdsch_enable_coworker(srslte_pdsch_t* q);
SRSLTE_API int srslte_pdsch_set_cell(srslte_pdsch_t* q, srslte_cell_t cell);
SRSLTE_API int srslte_pdsch_set_rnti(srslte_pdsch_t* q, uint16_t rnti);
2019-04-23 01:53:11 -07:00
SRSLTE_API void srslte_pdsch_free_rnti(srslte_pdsch_t* q, uint16_t rnti);
/* These functions do not modify the state and run in real-time */
SRSLTE_API int srslte_pdsch_encode(srslte_pdsch_t* q,
srslte_dl_sf_cfg_t* sf,
srslte_pdsch_cfg_t* cfg,
uint8_t* data[SRSLTE_MAX_CODEWORDS],
cf_t* sf_symbols[SRSLTE_MAX_PORTS]);
SRSLTE_API int srslte_pdsch_decode(srslte_pdsch_t* q,
srslte_dl_sf_cfg_t* sf,
srslte_pdsch_cfg_t* cfg,
srslte_chest_dl_res_t* channel,
cf_t* sf_symbols[SRSLTE_MAX_PORTS],
srslte_pdsch_res_t data[SRSLTE_MAX_CODEWORDS]);
SRSLTE_API int srslte_pdsch_select_pmi(srslte_pdsch_t* q,
srslte_chest_dl_res_t* channel,
uint32_t nof_layers,
uint32_t* best_pmi,
float sinr[SRSLTE_MAX_CODEBOOKS]);
SRSLTE_API int srslte_pdsch_compute_cn(srslte_pdsch_t* q, srslte_chest_dl_res_t* channel, float* cn);
SRSLTE_API uint32_t srslte_pdsch_grant_rx_info(srslte_pdsch_grant_t* grant,
srslte_pdsch_res_t res[SRSLTE_MAX_CODEWORDS],
char* str,
uint32_t str_len);
SRSLTE_API uint32_t srslte_pdsch_rx_info(srslte_pdsch_cfg_t* cfg,
srslte_pdsch_res_t res[SRSLTE_MAX_CODEWORDS],
char* str,
uint32_t str_len);
SRSLTE_API uint32_t srslte_pdsch_tx_info(srslte_pdsch_cfg_t* cfg, char* str, uint32_t str_len);
2018-03-31 10:04:04 -07:00
#endif // SRSLTE_PDSCH_H