srsLTE/lib/include/srsran/phy/phch/psbch.h

104 lines
2.6 KiB
C
Raw Normal View History

/**
2019-10-11 03:10:07 -07:00
*
* \section COPYRIGHT
2019-10-11 03:10:07 -07:00
*
2021-03-19 03:45:56 -07:00
* Copyright 2013-2021 Software Radio Systems Limited
2019-10-11 03:10:07 -07:00
*
* 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.
2019-10-11 03:10:07 -07:00
*
*/
2021-03-19 03:45:56 -07:00
#ifndef SRSRAN_PSBCH_H
#define SRSRAN_PSBCH_H
2019-10-11 03:10:07 -07:00
2021-03-19 03:45:56 -07:00
#include "srsran/phy/common/phy_common_sl.h"
#include "srsran/phy/dft/dft_precoding.h"
#include "srsran/phy/fec/convolutional/convcoder.h"
#include "srsran/phy/fec/convolutional/viterbi.h"
#include "srsran/phy/fec/crc.h"
#include "srsran/phy/modem/demod_soft.h"
#include "srsran/phy/modem/modem_table.h"
#include "srsran/phy/scrambling/scrambling.h"
2019-10-11 03:10:07 -07:00
2021-03-19 03:45:56 -07:00
#define SRSRAN_SL_BCH_CRC_LEN 16
2019-10-11 03:10:07 -07:00
2019-12-20 03:23:28 -08:00
/**
* \brief Physical Sidelink broadcast channel.
*
* Reference: 3GPP TS 36.211 version 15.6.0 Release 15 Sec. 9.6
*/
2021-03-19 03:45:56 -07:00
typedef struct SRSRAN_API {
2019-12-20 03:23:28 -08:00
uint32_t N_sl_id;
2021-03-19 03:45:56 -07:00
srsran_sl_tm_t tm;
srsran_cp_t cp;
2019-12-20 03:23:28 -08:00
2020-01-08 08:23:16 -08:00
uint32_t nof_data_re; ///< Number of RE considered during the channel mapping
uint32_t nof_tx_re; ///< Number of RE actually transmitted over the air (without last OFDM symbol)
2019-10-11 03:10:07 -07:00
uint32_t E;
uint32_t Qm;
uint32_t nof_prb;
2019-12-20 03:23:28 -08:00
uint32_t nof_data_symbols;
2020-01-08 08:23:16 -08:00
uint32_t nof_tx_symbols;
2019-12-20 03:23:28 -08:00
uint32_t sl_bch_tb_len;
uint32_t sl_bch_tb_crc_len;
uint32_t sl_bch_encoded_len;
2019-10-11 03:10:07 -07:00
float precoding_scaling;
// data
2019-12-20 03:23:28 -08:00
uint8_t* c;
2019-10-11 03:10:07 -07:00
// crc
2021-03-19 03:45:56 -07:00
srsran_crc_t crc_mib_sl;
2019-10-11 03:10:07 -07:00
uint8_t* crc_temp;
// channel coding
2021-03-19 03:45:56 -07:00
srsran_viterbi_t dec;
srsran_convcoder_t encoder;
2019-10-11 03:10:07 -07:00
uint8_t* d;
2020-01-08 08:23:16 -08:00
int16_t* d_16;
2019-10-11 03:10:07 -07:00
// rate matching
uint8_t* e;
2020-01-08 08:23:16 -08:00
uint8_t* e_bytes; ///< To pack bits to bytes
int16_t* e_16;
2019-12-20 03:23:28 -08:00
uint8_t* codeword;
2020-01-08 08:23:16 -08:00
uint8_t* codeword_bytes;
int16_t* llr;
2019-10-11 03:10:07 -07:00
// interleaving
uint32_t* interleaver_lut;
// scrambling
2021-03-19 03:45:56 -07:00
srsran_sequence_t seq;
2019-10-11 03:10:07 -07:00
// modulation
2021-03-19 03:45:56 -07:00
srsran_modem_table_t mod;
2019-12-20 03:23:28 -08:00
cf_t* mod_symbols;
2019-10-11 03:10:07 -07:00
// dft precoding
2021-03-19 03:45:56 -07:00
srsran_dft_precoding_t dft_precoder;
srsran_dft_precoding_t idft_precoder;
2019-10-11 03:10:07 -07:00
cf_t* scfdma_symbols;
2021-03-19 03:45:56 -07:00
} srsran_psbch_t;
2019-10-11 03:10:07 -07:00
2021-03-19 03:45:56 -07:00
SRSRAN_API int
srsran_psbch_init(srsran_psbch_t* q, uint32_t nof_prb, uint32_t N_sl_id, srsran_sl_tm_t tm, srsran_cp_t cp);
2019-12-20 03:23:28 -08:00
2021-03-19 03:45:56 -07:00
SRSRAN_API void srsran_psbch_free(srsran_psbch_t* q);
2019-12-20 03:23:28 -08:00
2021-03-19 03:45:56 -07:00
SRSRAN_API int srsran_psbch_encode(srsran_psbch_t* q, uint8_t* input, uint32_t input_len, cf_t* sf_buffer);
2019-12-20 03:23:28 -08:00
2021-03-19 03:45:56 -07:00
SRSRAN_API int srsran_psbch_decode(srsran_psbch_t* q, cf_t* scfdma_symbols, uint8_t* output, uint32_t max_output_len);
2019-10-11 03:10:07 -07:00
2021-03-19 03:45:56 -07:00
SRSRAN_API int srsran_psbch_reset(srsran_psbch_t* q, uint32_t N_sl_id);
2019-10-11 03:10:07 -07:00
2021-03-19 03:45:56 -07:00
SRSRAN_API int srsran_psbch_put(srsran_psbch_t* q, cf_t* symbols, cf_t* sf_buffer);
2019-10-11 03:10:07 -07:00
2021-03-19 03:45:56 -07:00
SRSRAN_API int srsran_psbch_get(srsran_psbch_t* q, cf_t* sf_buffer, cf_t* symbols);
2019-10-11 03:10:07 -07:00
2021-03-19 03:45:56 -07:00
#endif // SRSRAN_PSBCH_H